It is intended to be used as a parameter type to restrict a
collection value to be non-empty. This restriction is guaranteed
statically, i.e., it is not possible to pass an empty collection
as a parameter of type NonEmpty[].
The static safety is guaranteed by two reasons:
1. there is no way to create an instance of NonEmpty[] other than
by factory methods provided by singleton object NonEmpty
2. there is only two factory methods:
an implicit conversion from Traversable[T] to
Option[NonEmpty[T]] where an empty value will be None
an apply which takes at least one argument
A value of type NonEmpty[T] can be used as a Traversable[T] by an
implicit conversion from NonEmpty[T] to Traversable[T].
A trait for non-empty traversable collections.
It is intended to be used as a parameter type to restrict a collection value to be non-empty. This restriction is guaranteed statically, i.e., it is not possible to pass an empty collection as a parameter of type NonEmpty[].
The static safety is guaranteed by two reasons: 1. there is no way to create an instance of NonEmpty[] other than by factory methods provided by singleton object NonEmpty 2. there is only two factory methods:
A value of type NonEmpty[T] can be used as a Traversable[T] by an implicit conversion from NonEmpty[T] to Traversable[T].