Trait/Object

zio.prelude

NonEmptyList

Related Docs: object NonEmptyList | package prelude

Permalink

sealed trait NonEmptyList[+A] extends AnyRef

A NonEmptyList[A] is a list of one or more values of type A. Unlike a List, a NonEmptyList is guaranteed to contain at least one element. This additional structure allows some operations to be defined on NonEmptyList that are not safe on List, such as head and reduceAll.

For interoperability with Scala's collection library an implicit conversion is provided from NonEmptyList to the :: case of List. Operations that cannot preserve the guarantee that the resulting collection must have at least one element will return a List instead.

Self Type
NonEmptyList[A]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NonEmptyList
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def head: A

    Permalink

    Returns the head of this NonEmptyList.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ++[A1 >: A](that: NonEmptyList[A1]): NonEmptyList[A1]

    Permalink

    Concatenates this NonEmptyList with the specified NonEmptyList.

  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def contains[A1 >: A](a: A1)(implicit A: Equal[A1]): Boolean

    Permalink

    Returns whether this NonEmptyList contains the specified element.

  8. final def corresponds[B](that: NonEmptyList[B])(f: (A, B) ⇒ Boolean): Boolean

    Permalink

    Determines whether this NonEmptyList and the specified NonEmptyList have the same length and every pair of corresponding elements of this NonEmptyList and the specified NonEmptyList satisfy the specified predicate.

    Determines whether this NonEmptyList and the specified NonEmptyList have the same length and every pair of corresponding elements of this NonEmptyList and the specified NonEmptyList satisfy the specified predicate.

    Annotations
    @tailrec()
  9. final def count(f: (A) ⇒ Boolean): Int

    Permalink

    Returns the number of elements in this NonEmptyList that satisfy the specified predicate.

  10. final def distinct: NonEmptyList[A]

    Permalink

    Removes duplicate elements from this NonEmptyList.

  11. final def drop(n: Int): List[A]

    Permalink

    Drops the first n elements from this NonEmptyList returning a List.

    Drops the first n elements from this NonEmptyList returning a List.

    Annotations
    @tailrec()
  12. final def dropRight(n: Int): List[A]

    Permalink

    Drops the last n elements from this NonEmptyList returning a List.

  13. final def dropWhile(f: (A) ⇒ Boolean): List[A]

    Permalink

    Drops elements from the start of this NonEmptyList that satisfy the specified predicate returning a List.

    Drops elements from the start of this NonEmptyList that satisfy the specified predicate returning a List.

    Annotations
    @tailrec()
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. final def equals(that: Any): Boolean

    Permalink

    Returns whether this NonEmptyList and the specified NonEmptyList are equal to each other.

    Returns whether this NonEmptyList and the specified NonEmptyList are equal to each other.

    Definition Classes
    NonEmptyList → AnyRef → Any
  16. final def exists(f: (A) ⇒ Boolean): Boolean

    Permalink

    Returns whether an element exists in this NonEmptyList satisfying the specified predicate.

    Returns whether an element exists in this NonEmptyList satisfying the specified predicate.

    Annotations
    @tailrec()
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def find(f: (A) ⇒ Boolean): Option[A]

    Permalink

    Returns the first element in this NonEmptyList satisfying the specified predicate or None otherwise.

    Returns the first element in this NonEmptyList satisfying the specified predicate or None otherwise.

    Annotations
    @tailrec()
  19. final def flatMap[B](f: (A) ⇒ NonEmptyList[B]): NonEmptyList[B]

    Permalink

    Transforms each element of this NonEmptyList to a NonEmptyList and combines them into a single NonEmptyList.

  20. final def flatten[B](implicit ev: <:<[A, NonEmptyList[B]]): NonEmptyList[B]

    Permalink

    Flattens a NonEmptyList of NonEmptyList values into a single NonEmptyList.

  21. final def foldLeft[B](z: B)(f: (B, A) ⇒ B): B

    Permalink

    Folds over the elements of this NonEmptyList from left to right using the specified initial value and combining function

    Folds over the elements of this NonEmptyList from left to right using the specified initial value and combining function

    Annotations
    @tailrec()
  22. final def foldRight[B](z: B)(op: (A, B) ⇒ B): B

    Permalink

    Folds over the elements of this NonEmptyList from right to left using the specified initial value and combining function.

  23. final def forEach[F[+_], B](f: (A) ⇒ F[B])(implicit arg0: AssociativeBoth[F], arg1: Covariant[F]): F[NonEmptyList[B]]

    Permalink

    Transforms each element of this NonEmptyList with the specified effectual function.

  24. final def forall(f: (A) ⇒ Boolean): Boolean

    Permalink

    Returns whether all elements of this NonEmptyList satisfy the specified predicate.

    Returns whether all elements of this NonEmptyList satisfy the specified predicate.

    Annotations
    @tailrec()
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def hashCode(): Int

    Permalink

    Returns the hashCode of this NonEmptyList.

    Returns the hashCode of this NonEmptyList.

    Definition Classes
    NonEmptyList → AnyRef → Any
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. final def length: Int

    Permalink

    Returns the length of this NonEmptyList.

  29. final def map[B](f: (A) ⇒ B): NonEmptyList[B]

    Permalink

    Transforms the elements of this NonEmptyList with the specified function.

  30. final def max(implicit A: Ord[A]): A

    Permalink

    Returns the maximum element in this NonEmptyList.

  31. final def maxBy[B](f: (A) ⇒ B)(implicit B: Ord[B]): A

    Permalink

    Returns the maximum element in this NonEmptyList using the specified function to map values of type A to values of type B that an ordering is defined on.

  32. final def min(implicit A: Ord[A]): A

    Permalink

    Returns the minimum element in this NonEmptyList.

  33. final def minBy[B](f: (A) ⇒ B)(implicit B: Ord[B]): A

    Permalink

    Returns the minimum element in this NonEmptyList using the specified function to map values of type A to values of type B that an ordering is defined on.

  34. final def mkString(start: String, sep: String, end: String): String

    Permalink

    Renders the elements of this NonEmptyList as a String using the specified separator and start and end values.

  35. final def mkString(sep: String): String

    Permalink

    Renders the elements of this NonEmptyList as a String using the specified separator.

  36. final def mkString: String

    Permalink

    Renders the elements of this NonEmptyList as a String.

  37. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  38. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. final def peel: (A, List[A])

    Permalink

    Decomposes the NonEmptyList into an element and a (possibly empty) List

  41. final def peelNonEmpty: (A, Option[NonEmptyList[A]])

    Permalink

    Returns an element of this NonEmptyList and the remainder or None, if the remainder is empty.

  42. final def product[A1 >: A](implicit A: Associative[Prod[A1]]): A1

    Permalink

    Returns the product of the elements of this NonEmptyList.

  43. final def reduce[A1 >: A](implicit A: Associative[A1]): A1

    Permalink

    Reduces the elements of this NonEmptyList using the specified associative operator.

  44. final def reduceLeft[A1 >: A](f: (A1, A1) ⇒ A1): A1

    Permalink

    Reduces the elements of this NonEmptyList from left to right using the specified function.

  45. final def reduceMap[B](f: (A) ⇒ B)(implicit B: Associative[B]): B

    Permalink

    Maps each element of this NonEmptyList to a type B that has an associative operation then combines them all with the associative operation.

  46. final def reduceMapLeft[B](map: (A) ⇒ B)(reduce: (B, A) ⇒ B): B

    Permalink

    Reduces the elements of this NonEmptyList from left to right using the function map to transform the first value to the type B and then the function reduceAll to combine the B value with each other A value.

  47. final def reduceMapRight[B](map: (A) ⇒ B)(reduce: (A, B) ⇒ B): B

    Permalink

    Reduces the elements of this NonEmptyList from right to left using the function map to transform the first value to the type B and then the function reduceAll to combine the B value with each other A value.

  48. final def reduceRight[A1 >: A](f: (A1, A1) ⇒ A1): A1

    Permalink

    Reduces the elements of this NonEmptyList from right to left using the specified function.

  49. final def reverse: NonEmptyList[A]

    Permalink

    Reverses the order of elements in this NonEmptyList.

  50. final def sum[A1 >: A](implicit A: Associative[Sum[A1]]): A1

    Permalink

    Returns the sum of the elements of this NonEmptyList.

  51. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  52. final def tailNonEmpty: Option[NonEmptyList[A]]

    Permalink

    Returns the tail of this NonEmptyList if it exists or None otherwise.

  53. final def tails: NonEmptyList[NonEmptyList[A]]

    Permalink

    Returns a new NonEmptyList composed of this NonEmptyList followed by each of its tails, ending with a singleton NonEmptyList.

  54. final def take(n: Int): List[A]

    Permalink

    Takes the first n elements from this NonEmptyList returning a List.

  55. final def takeRight(n: Int): List[A]

    Permalink

    Takes the last n elements from this NonEmptyList returning a List.

  56. final def takeWhile(f: (A) ⇒ Boolean): List[A]

    Permalink

    Takes elements from the start of this NonEmptyList that satisfy the specified predicate returning a List.

  57. final def toCons[A1 >: A]: ::[A1]

    Permalink

    Converts this NonEmptyList to the :: case of a List.

  58. final def toNonEmptyChunk: NonEmptyChunk[A]

    Permalink

    Converts this NonEmptyList to a NonEmptyChunk.

  59. final def toString(): String

    Permalink

    Renders this NonEmptyList as a String.

    Renders this NonEmptyList as a String.

    Definition Classes
    NonEmptyList → AnyRef → Any
  60. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  62. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  63. final def zip[B](that: NonEmptyList[B]): NonEmptyList[(A, B)]

    Permalink

    Zips this NonEmptyList together with the specified NonEmptyList, returning a new NonEmptyList with a length equal to the minimum of the two and elements combined pairwise.

  64. final def zipWith[B, C](that: NonEmptyList[B])(f: (A, B) ⇒ C): NonEmptyList[C]

    Permalink

    Zips this NonEmptyList together with the specified NonEmptyList, returning a new NonEmptyList with a length equal to the minimum of the two and elements combined pairwise using the specified function.

  65. final def zipWithIndex: NonEmptyList[(A, Int)]

    Permalink

    Annotates each element of this NonEmptyList with its index.

Inherited from AnyRef

Inherited from Any

Ungrouped