NonEmptyLazyListOps

final class NonEmptyLazyListOps[A](value: Type[A]) extends AnyVal with NonEmptyCollection[A, LazyList, NonEmptyLazyList]
trait NonEmptyCollection[A, LazyList, NonEmptyLazyList]
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

final def #::[AA >: A](a: AA): Type[AA]

Alias for prepend.

Alias for prepend.

final def ++[AA >: A](nell: Type[AA]): Type[AA]

Alias for concatNell

Alias for concatNell

final def ++:[AA >: A](c: Type[AA]): Type[AA]

Alias for prependNell

Alias for prependNell

final def +:[AA >: A](a: AA): Type[AA]

Alias for prepend.

Alias for prepend.

final def :+[AA >: A](a: AA): Type[AA]

Alias for append.

Alias for append.

final def :++[AA >: A](c: LazyList[AA]): Type[AA]

Alias for appendLazyList

Alias for appendLazyList

final def append[AA >: A](a: AA): Type[AA]

Returns a new NonEmptyLazyList consisting of this followed by a

Returns a new NonEmptyLazyList consisting of this followed by a

final def appendLazyList[AA >: A](nell: LazyList[AA]): Type[AA]

Appends the given LazyList

Appends the given LazyList

final def collect[B](pf: PartialFunction[A, B]): LazyList[B]

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.

final def collectFirst[B](pf: PartialFunction[A, B]): Option[B]

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.

final def concat[AA >: A](ll: LazyList[AA]): Type[AA]

concatenates this with ll

concatenates this with ll

final def concatNell[AA >: A](nell: Type[AA]): Type[AA]

Concatenates this with nell

Concatenates this with nell

final def contains(a: A)(A: Eq[A]): Boolean

Tests if some element is contained in this NonEmptyLazyList

Tests if some element is contained in this NonEmptyLazyList

def distinct[AA >: A](O: Order[AA]): Type[AA]

Remove duplicates. Duplicates are checked using Order[_] instance.

Remove duplicates. Duplicates are checked using Order[_] instance.

final def exists(f: A => Boolean): Boolean

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

final def filter(p: A => Boolean): LazyList[A]

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.

final def filterNot(p: A => Boolean): LazyList[A]

Filters all elements of this NonEmptyLazyList that satisfy the given predicate.

Filters all elements of this NonEmptyLazyList that satisfy the given predicate.

final def find(f: A => Boolean): Option[A]

Returns the first value that matches the given predicate.

Returns the first value that matches the given predicate.

final def flatMap[B](f: A => Type[B]): Type[B]

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

final def foldLeft[B](b: B)(f: (B, A) => B): B

Left-associative fold using f.

Left-associative fold using f.

final def foldRight[B](z: B)(f: (A, B) => B): B

Right-associative fold using f.

Right-associative fold using f.

final def forall(p: A => Boolean): Boolean

Tests whether a predicate holds for all elements

Tests whether a predicate holds for all elements

final def groupBy[B](f: A => B)(B: Order[B]): SortedMap[B, Type[A]]

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
final def groupByNem[B](f: A => B)(B: Order[B]): Type[B, Type[A]]

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
def grouped(size: Int): Iterator[Type[A]]

Partitions elements in fixed size NonEmptyLazyLists.

Partitions elements in fixed size NonEmptyLazyLists.

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
final def head: A

Returns the first element

Returns the first element

final def init: LazyList[A]

Returns all elements but the last

Returns all elements but the last

final def iterator: Iterator[A]
final def last: A

Returns the last element

Returns the last element

final def length: Int

Returns the length of this NonEmptyLazyList

Returns the length of this NonEmptyLazyList

final def map[B](f: A => B): Type[B]
final def prepend[AA >: A](a: AA): Type[AA]

Returns a new NonEmptyLazyList consisting of a followed by this

Returns a new NonEmptyLazyList consisting of a followed by this

final def prependLazyList[AA >: A](c: LazyList[AA]): Type[AA]

Prepends the given LazyList

Prepends the given LazyList

final def prependNell[AA >: A](c: Type[AA]): Type[AA]

Prepends the given NonEmptyLazyList

Prepends the given NonEmptyLazyList

final def reduce[AA >: A](S: Semigroup[AA]): AA

Reduce using the Semigroup of A

Reduce using the Semigroup of A

final def reduceLeft(f: (A, A) => A): A

Left-associative reduce using f.

Left-associative reduce using f.

final def reduceLeftTo[B](f: A => B)(g: (B, A) => B): B

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.

final def reduceRight[AA >: A](f: (A, AA) => AA): AA

Right-associative reduce using f.

Right-associative reduce using f.

final def reduceRightTo[B](f: A => B)(g: (A, B) => B): B

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.

final def reverse: Type[A]

Reverses this NonEmptyLazyList

Reverses this NonEmptyLazyList

final def reverseIterator: Iterator[A]
final def show[AA >: A](AA: Show[AA]): String
final def size: Int

Returns the size of this NonEmptyLazyList

Returns the size of this NonEmptyLazyList

final def sortBy[B](f: A => B)(B: Order[B]): Type[A]

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))
final def sorted[AA >: A](AA: Order[AA]): Type[AA]

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)
final def tail: LazyList[A]

Returns all but the first element

Returns all but the first element

final def toLazyList: LazyList[A]

Converts this NonEmptyLazyList to a LazyList

Converts this NonEmptyLazyList to a LazyList

final def toNem[T, U](ev: A <:< (T, U), order: Order[T]): Type[T, U]

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
final def toNes[B >: A](order: Order[B]): Type[B]

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)
final def toNev[B >: A]: NonEmptyVector[B]

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

Converts this NonEmptyLazyList to a NonEmptyList.

Converts this NonEmptyLazyList to a NonEmptyList.

Converts this LazyList to a NonEmptyVector.

Converts this LazyList to a NonEmptyVector.

final def zipWith[B, C](b: Type[B])(f: (A, B) => C): Type[C]

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

final def zipWithIndex: Type[(A, Int)]

Zips each element of this NonEmptyLazyList with its index

Zips each element of this NonEmptyLazyList with its index

Deprecated methods

@deprecated("Use collectFirst", "2.2.0-M1")
final def collectLazyList[B](pf: PartialFunction[A, B]): Option[B]

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