Class/Object

cats.data

NonEmptyVector

Related Docs: object NonEmptyVector | package data

Permalink

final class NonEmptyVector[+A] extends AnyVal

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 empty NonEmptyVector. However, due to https://issues.scala-lang.org/browse/SI-6601, on Scala 2.10, this may be bypassed due to a compiler bug.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NonEmptyVector
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

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

    Permalink
    Definition Classes
    Any
  3. def ++[AA >: A](other: Vector[AA]): NonEmptyVector[AA]

    Permalink

    Alias for concat

  4. def ++:[AA >: A](other: NonEmptyVector[AA]): NonEmptyVector[AA]

    Permalink

    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)
  5. def +:[AA >: A](a: AA): NonEmptyVector[AA]

    Permalink

    Alias for prepend

  6. def :+[AA >: A](a: AA): NonEmptyVector[AA]

    Permalink

    Alias for append

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

    Permalink
    Definition Classes
    Any
  8. def ===[AA >: A](that: NonEmptyVector[AA])(implicit A: Eq[AA]): Boolean

    Permalink

    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.

  9. def append[AA >: A](a: AA): NonEmptyVector[AA]

    Permalink

    Append an item to this, producing a new NonEmptyVector.

  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. def collect[B](pf: PartialFunction[A, B]): Vector[B]

    Permalink
  12. def concat[AA >: A](other: Vector[AA]): NonEmptyVector[AA]

    Permalink

    Append another Vector to this, producing a new NonEmptyVector.

  13. def concatNev[AA >: A](other: NonEmptyVector[AA]): NonEmptyVector[AA]

    Permalink

    Append another NonEmptyVector to this, producing a new NonEmptyVector.

  14. def distinct[AA >: A](implicit O: Order[AA]): NonEmptyVector[AA]

    Permalink

    Remove duplicates.

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

  15. def exists(f: (A) ⇒ Boolean): Boolean

    Permalink

    Check whether at least one element satisfies the predicate.

  16. def filter(f: (A) ⇒ Boolean): Vector[A]

    Permalink

    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)
  17. def filterNot(f: (A) ⇒ Boolean): Vector[A]

    Permalink

    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)
  18. def find(f: (A) ⇒ Boolean): Option[A]

    Permalink

    Find the first element matching the predicate, if one exists

  19. def flatMap[B](f: (A) ⇒ NonEmptyVector[B]): NonEmptyVector[B]

    Permalink

    Applies f to all elements and combines the result

  20. def foldLeft[B](b: B)(f: (B, A) ⇒ B): B

    Permalink

    Left-associative fold using f.

  21. def foldRight[B](lb: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B]): Eval[B]

    Permalink

    Right-associative fold using f.

  22. def forall(f: (A) ⇒ Boolean): Boolean

    Permalink

    Check whether all elements satisfy the predicate.

  23. def get(i: Int): Option[A]

    Permalink

    Gets the element at the index, if it exists

  24. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  25. def getUnsafe(i: Int): A

    Permalink

    Gets the element at the index, or throws an exception if none exists

  26. def head: A

    Permalink
  27. def init: Vector[A]

    Permalink
  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. def last: A

    Permalink
  30. def length: Int

    Permalink
  31. def map[B](f: (A) ⇒ B): NonEmptyVector[B]

    Permalink

    Applies f to all the elements

  32. def prepend[AA >: A](a: AA): NonEmptyVector[AA]

    Permalink

    Prepend an item to this, producing a new NonEmptyVector.

  33. def reduce[AA >: A](implicit S: Semigroup[AA]): AA

    Permalink

    Reduce using the Semigroup of A

  34. def reduceLeft[AA >: A](f: (AA, AA) ⇒ AA): AA

    Permalink

    Left-associative reduce using f.

  35. def reverse: NonEmptyVector[A]

    Permalink
  36. def show[AA >: A](implicit AA: Show[AA]): String

    Permalink

    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.

  37. def sortBy[B](f: (A) ⇒ B)(implicit B: Order[B]): NonEmptyVector[A]

    Permalink
  38. def sorted[AA >: A](implicit AA: Order[AA]): NonEmptyVector[AA]

    Permalink
  39. def tail: Vector[A]

    Permalink
  40. def toString(): String

    Permalink
    Definition Classes
    NonEmptyVector → Any
  41. val toVector: Vector[A]

    Permalink
  42. def updated[AA >: A](i: Int, a: AA): Option[NonEmptyVector[AA]]

    Permalink

    Updates the element at the index, if it exists

  43. def updatedUnsafe[AA >: A](i: Int, a: AA): NonEmptyVector[AA]

    Permalink

    Updates the element at the index, or throws an IndexOutOfBoundsException if none exists (if i does not satisfy 0 <= i < length).

  44. def zipWith[B, C](b: NonEmptyVector[B])(f: (A, B) ⇒ C): NonEmptyVector[C]

    Permalink

    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)
  45. def zipWithIndex: NonEmptyVector[(A, Int)]

    Permalink

Inherited from AnyVal

Inherited from Any

Ungrouped