Alias for concat
Append this NEV to another NEV, producing a new NonEmptyVector
.
Append this NEV to another NEV, producing a new NonEmptyVector
.
scala> import cats.data.NonEmptyVector scala> val nev = NonEmptyVector.of(1, 2, 3) scala> nev ++: NonEmptyVector.of(4, 5) res0: cats.data.NonEmptyVector[Int] = NonEmptyVector(1, 2, 3, 4, 5)
Alias for prepend
Alias for append
Typesafe equality operator.
Typesafe equality operator.
This method is similar to == except that it only allows two NonEmptyVector[A] values to be compared to each other, and uses equality provided by Eq[_] instances, rather than using the universal equality provided by .equals.
Append an item to this, producing a new NonEmptyVector
.
Append another Vector
to this, producing a new NonEmptyVector
.
Append another NonEmptyVector
to this, producing a new NonEmptyVector
.
Remove duplicates.
Remove duplicates. Duplicates are checked using Order[_]
instance.
Check whether at least one element satisfies the predicate.
Remove elements not matching the predicate
Remove elements not matching the predicate
scala> import cats.data.NonEmptyVector scala> val nev = NonEmptyVector.of(1, 2, 3, 4, 5) scala> nev.filter(_ < 3) res0: scala.collection.immutable.Vector[Int] = Vector(1, 2)
Remove elements matching the predicate
Remove elements matching the predicate
scala> import cats.data.NonEmptyVector scala> val nev = NonEmptyVector.of(1, 2, 3, 4, 5) scala> nev.filterNot(_ < 3) res0: scala.collection.immutable.Vector[Int] = Vector(3, 4, 5)
Find the first element matching the predicate, if one exists
Applies f to all elements and combines the result
Left-associative fold using f.
Right-associative fold using f.
Check whether all elements satisfy the predicate.
Gets the element at the index, if it exists
Gets the element at the index, or throws an exception if none exists
Applies f to all the elements
Prepend an item to this, producing a new NonEmptyVector
.
Reduce using the Semigroup of A
Left-associative reduce using f.
Typesafe stringification method.
Typesafe stringification method.
This method is similar to .toString except that it stringifies values according to Show[_] instances, rather than using the universal .toString method.
Updates the element at the index, if it exists
Updates the element at the index, or throws an IndexOutOfBoundsException
if none exists (if i
does not satisfy 0 <= i < length
).
Zips this NonEmptyVector
with another NonEmptyVector
and applies a function for each pair of elements.
Zips this NonEmptyVector
with another NonEmptyVector
and applies a function for each pair of elements.
scala> import cats.data.NonEmptyVector scala> val as = NonEmptyVector.of(1, 2, 3) scala> val bs = NonEmptyVector.of("A", "B", "C") scala> as.zipWith(bs)(_ + _) res0: cats.data.NonEmptyVector[String] = NonEmptyVector(1A, 2B, 3C)
A data type which represents a
Vector
guaranteed to contain at least one element.Note that the constructor is
private
to prevent accidental construction of an emptyNonEmptyVector
. However, due to https://issues.scala-lang.org/browse/SI-6601, on Scala 2.10, this may be bypassed due to a compiler bug.