Append another NonEmptyList
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.NonEmptyList scala> val nel = NonEmptyList.of(1, 2, 3, 4, 5) scala> nel.filter(_ < 3) res0: scala.collection.immutable.List[Int] = List(1, 2)
Remove elements matching the predicate
Remove elements matching the predicate
scala> import cats.data.NonEmptyList scala> val nel = NonEmptyList.of(1, 2, 3, 4, 5) scala> nel.filterNot(_ < 3) res0: scala.collection.immutable.List[Int] = List(3, 4, 5)
Find the first element matching the predicate, if one exists
Left-associative fold on the structure using f.
Right-associative fold on the structure using f.
Check whether all elements satisfy the predicate
Applies f to all the elements of the structure
Reduce using the Semigroup
of AA
.
Left-associative reduce using f.
Reverse this NonEmptyList
.
Reverse this NonEmptyList
.
scala> import cats.data.NonEmptyList scala> val nel = NonEmptyList.of(1, 2, 3) scala> nel.reverse res0: cats.data.NonEmptyList[Int] = NonEmptyList(3, 2, 1)
Return the head and tail into a single list
Zips each element of this NonEmptyList
with its index.
Zips each element of this NonEmptyList
with its index.
scala> import cats.data.NonEmptyList scala> val nel = NonEmptyList.of("a", "b", "c") scala> nel.zipWithIndex res0: cats.data.NonEmptyList[(String, Int)] = NonEmptyList((a,0), (b,1), (c,2))
A data type which represents a non empty list of A, with single element (head) and optional structure (tail).