NonEmptyLazyListOps
Value members
Concrete methods
Returns a new NonEmptyLazyList consisting of this followed by a
Returns a new NonEmptyLazyList consisting of this followed by a
Returns a new LazyList
containing all elements where the result of pf
is final defined.
Returns a new LazyList
containing all elements where the result of pf
is final defined.
Finds the first element of this NonEmptyLazyList
for which the given partial
function is defined, and applies the partial function to it.
Finds the first element of this NonEmptyLazyList
for which the given partial
function is defined, and applies the partial function to it.
Tests if some element is contained in this NonEmptyLazyList
Tests if some element is contained in this NonEmptyLazyList
Remove duplicates. Duplicates are checked using Order[_]
instance.
Remove duplicates. Duplicates are checked using Order[_]
instance.
Tests whether a predicate holds for at least one element of this LazyList
Tests whether a predicate holds for at least one element of this LazyList
Filters all elements of this NonEmptyLazyList that do not satisfy the given predicate.
Filters all elements of this NonEmptyLazyList that do not satisfy the given predicate.
Filters all elements of this NonEmptyLazyList that satisfy the given predicate.
Filters all elements of this NonEmptyLazyList that satisfy the given predicate.
Returns the first value that matches the given predicate.
Returns the first value that matches the given predicate.
Applies the supplied function to each element and returns a new NonEmptyLazyList from the concatenated results
Applies the supplied function to each element and returns a new NonEmptyLazyList from the concatenated results
Groups elements inside this NonEmptyLazyList
according to the Order
of the keys produced by the given mapping function.
Groups elements inside this NonEmptyLazyList
according to the Order
of the keys produced by the given mapping function.
scala> import scala.collection.immutable.SortedMap
scala> import cats.data.NonEmptyLazyList
scala> import cats.implicits._
scala> val nel = NonEmptyLazyList(12, -2, 3, -5)
scala> val expectedResult = SortedMap(false -> NonEmptyLazyList(-2, -5), true -> NonEmptyLazyList(12, 3))
scala> val result = nel.groupBy(_ >= 0)
scala> result === expectedResult
res0: Boolean = true
Groups elements inside this NonEmptyLazyList
according to the Order
of the keys produced by the given mapping function.
Groups elements inside this NonEmptyLazyList
according to the Order
of the keys produced by the given mapping function.
scala> import cats.data.{NonEmptyLazyList, NonEmptyMap}
scala> import cats.implicits._
scala> val nel = NonEmptyLazyList(12, -2, 3, -5)
scala> val expectedResult = NonEmptyMap.of(false -> NonEmptyLazyList(-2, -5), true -> NonEmptyLazyList(12, 3))
scala> val result = nel.groupByNem(_ >= 0)
scala> result === expectedResult
res0: Boolean = true
Partitions elements in fixed size NonEmptyLazyList
s.
Partitions elements in fixed size NonEmptyLazyList
s.
scala> import cats.data.NonEmptyLazyList
scala> import cats.implicits._
scala> val nel = NonEmptyLazyList.fromLazyListUnsafe(LazyList(12, -2, 3, -5))
scala> val expectedResult = List(
| NonEmptyLazyList.fromLazyListUnsafe(LazyList(12, -2)),
| NonEmptyLazyList.fromLazyListUnsafe(LazyList(3, -5))
| )
scala> val result = nel.grouped(2)
scala> result.toList === expectedResult
res0: Boolean = true
Returns a new NonEmptyLazyList consisting of a
followed by this
Returns a new NonEmptyLazyList consisting of a
followed by this
Apply f
to the "initial element" of this LazyList and lazily combine it
with every other value using the given function g
.
Apply f
to the "initial element" of this LazyList and lazily combine it
with every other value using the given function g
.
Apply f
to the "initial element" of this NonEmptyLazyList and
lazily combine it with every other value using the given function g
.
Apply f
to the "initial element" of this NonEmptyLazyList and
lazily combine it with every other value using the given function g
.
Sorts this NonEmptyLazyList
according to an Order
on transformed B
from A
Sorts this NonEmptyLazyList
according to an Order
on transformed B
from A
scala> import cats.data.NonEmptyLazyList
scala> import cats.instances.int._
scala> val nel = NonEmptyLazyList(('a', 4), ('z', 1), ('e', 22))
scala> nel.sortBy(_._2).toLazyList.toList
res0: List[(Char, Int)] = List((z,1), (a,4), (e,22))
Sorts this NonEmptyList
according to an Order
Sorts this NonEmptyList
according to an Order
scala> import cats.data.NonEmptyLazyList
scala> import cats.instances.int._
scala> val nel = NonEmptyLazyList(12, 4, 3, 9)
scala> nel.sorted.toLazyList.toList
res0: List[Int] = List(3, 4, 9, 12)
Creates new NonEmptyMap
, similarly to List#toMap from scala standard library.
Creates new NonEmptyMap
, similarly to List#toMap from scala standard library.
scala> import cats.data.{NonEmptyLazyList, NonEmptyMap}
scala> import cats.implicits._
scala> val nel = NonEmptyLazyList.fromLazyListPrepend((0, "a"), LazyList((1, "b"),(0, "c"), (2, "d")))
scala> val expectedResult = NonEmptyMap.of(0 -> "c", 1 -> "b", 2 -> "d")
scala> val result = nel.toNem
scala> result === expectedResult
res0: Boolean = true
Creates new NonEmptySet
, similarly to List#toSet from scala standard library.
Creates new NonEmptySet
, similarly to List#toSet from scala standard library.
scala> import cats.data._
scala> import cats.instances.int._
scala> val nel = NonEmptyLazyList.fromLazyListPrepend(1, LazyList(2,2,3,4))
scala> nel.toNes
res0: cats.data.NonEmptySet[Int] = TreeSet(1, 2, 3, 4)
Creates new NonEmptyVector
, similarly to List#toVector from scala standard library.
Creates new NonEmptyVector
, similarly to List#toVector from scala standard library.
scala> import cats.data._
scala> import cats.instances.int._
scala> val nel = NonEmptyLazyList.fromLazyListPrepend(1, LazyList(2,3,4))
scala> val expectedResult = NonEmptyVector.fromVectorUnsafe(Vector(1,2,3,4))
scala> val result = nel.toNev
scala> result === expectedResult
res0: Boolean = true
Zips this NonEmptyLazyList
with another NonEmptyLazyList
and applies a function for each pair of elements
Zips this NonEmptyLazyList
with another NonEmptyLazyList
and applies a function for each pair of elements
Deprecated methods
Finds the first element of this NonEmptyLazyList
for which the given partial
function is defined, and applies the partial function to it.
Finds the first element of this NonEmptyLazyList
for which the given partial
function is defined, and applies the partial function to it.
- Deprecated