Companion object for class NonEmptyVector.
- Companion:
- class
- Source:
- NonEmptyVector.scala
Value members
Concrete methods
Constructs a new NonEmptyVector given at least one element.
Constructs a new NonEmptyVector given at least one element.
- Type parameters:
- T
the type of the element contained in the new
NonEmptyVector
- Value parameters:
- firstElement
the first element (with index 0) contained in this
NonEmptyVector- otherElements
a varargs of zero or more other elements (with index 1, 2, 3, ...) contained in this
NonEmptyVector
- Source:
- NonEmptyVector.scala
Optionally construct a NonEmptyVector containing the elements, if any, of a given GenSeq.
Optionally construct a NonEmptyVector containing the elements, if any, of a given GenSeq.
- Value parameters:
- seq
the
GenSeqwith which to construct aNonEmptyVector
- Returns:
a
NonEmptyVectorcontaining the elements of the givenGenSeq, if non-empty, wrapped in aSome; elseNoneif theGenSeqis empty- Source:
- NonEmptyVector.scala
Variable argument extractor for NonEmptyVectors.
Variable argument extractor for NonEmptyVectors.
- Value parameters:
- nonEmptyVector:
the
NonEmptyVectorcontaining the elements to extract
- Returns:
an
Seqcontaining thisNonEmptyVectors elements, wrapped in aSome- Source:
- NonEmptyVector.scala
Implicits
Implicits
Implicit conversion from NonEmptyVector to Vector.
Implicit conversion from NonEmptyVector to Vector.
One use case for this implicit conversion is to enable GenSeq[NonEmptyVector]s to be flattened.
Here's an example:
scala> Vector(NonEmptyVector(1, 2, 3), NonEmptyVector(3, 4), NonEmptyVector(5, 6, 7, 8)).flatten res0: scala.collection.immutable.Vector[Int] = Vector(1, 2, 3, 3, 4, 5, 6, 7, 8)
- Value parameters:
- nonEmptyVector
the
NonEmptyVectorto convert to aVector
- Returns:
a
Vectorcontaining the elements, in order, of thisNonEmptyVector- Source:
- NonEmptyVector.scala