Packages

  • package root
    Definition Classes
    root
  • package cats

    The cats root package contains all the trait signatures of most Scala type classes.

    The cats root package contains all the trait signatures of most Scala type classes.

    Cats type classes are implemented using the approach from the Type classes as objects and implicits article.

    For each type class, cats provides three pieces: - Its signature: a trait that is polymorphic on a type parameter. Type class traits inherit from other type classes to indicate that any implementation of the lower type class (e.g. Applicative) can also serve as an instance for the higuer type class (e.g. Functor). - Type class 'instances, which are classes and objects that implement one or more type class signatures for some specific types. Type class instances for several data types from the Java or Scala standard libraries are declared in the subpackage cats.instances. - Syntax extensions, each of which provides the methods of the type class defines as extension methods (which in Scala 2 are encoded as implicit classes) for values of any type F; given that an instance of the type class for the receiver type (this) is in the implicit scope. Symtax extensions are declared in the cats.syntax package. - A set of laws, that are also generic on the type of the class, and are only defined on the operations of the type class. The purpose of these laws is to declare some algebraic relations (equations) between Scala expressions involving the operations of the type class, and test (but not verify) that implemented instances satisfy those equations. Laws are defined in the cats-laws package.

    Although most of cats type classes are declared in this package, some are declared in other packages: - type classes that operate on base types (kind *), and their implementations for standard library types, are contained in cats.kernel, which is a different SBT project. However, they are re-exported from this package. - type classes of kind F[_, _], such as cats.arrow.Profunctor" or cats.arrow.Arrow, which are relevant for Functional Reactive Programming or optics, are declared in the cats.arrow package. - Also, those type classes that abstract over (pure or impure) functional runtime effects are declared in the cats-effect library. - Some type classes for which no laws can be provided are left out of the main road, in a small and dirty alley. These are the alleycats.

    Definition Classes
    root
  • package data
    Definition Classes
    cats
  • AndThen
  • AppFunc
  • Binested
  • BinestedBifoldable
  • BinestedBitraverse
  • BinestedInstances
  • Chain
  • Cokleisli
  • Const
  • Cont
  • ContT
  • EitherK
  • EitherT
  • Func
  • IdT
  • IndexedReaderWriterStateT
  • IndexedState
  • IndexedStateT
  • Ior
  • IorT
  • Kleisli
  • KleisliFromFunctionPartiallyApplied
  • Nested
  • NonEmptyChainOps
  • NonEmptyList
  • NonEmptyMapOps
  • NonEmptySeq
  • NonEmptySetOps
  • NonEmptyVector
  • OneAnd
  • Op
  • OptionT
  • Reader
  • ReaderWriterState
  • ReaderWriterStateT
  • RepresentableStore
  • State
  • StateT
  • Store
  • Tuple2K
  • Validated
  • Writer
  • WriterT
  • ZipList
  • ZipSeq
  • ZipStream
  • ZipVector

final class NonEmptyVector[+A] extends AnyVal with NonEmptyCollection[A, Vector, NonEmptyVector]

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
NonEmptyCollection[A, Vector, NonEmptyVector], AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NonEmptyVector
  2. NonEmptyCollection
  3. AnyVal
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. def ++[AA >: A](other: Vector[AA]): NonEmptyVector[AA]

    Alias for concat

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

    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]

    Alias for prepend

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

    Alias for append

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

    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]

    Append an item to this, producing a new NonEmptyVector.

    Append an item to this, producing a new NonEmptyVector.

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def collect[B](pf: PartialFunction[A, B]): Vector[B]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  12. def concat[AA >: A](other: Vector[AA]): NonEmptyVector[AA]

    Append another Vector to this, producing a new NonEmptyVector.

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

    Append another NonEmptyVector to this, producing a new NonEmptyVector.

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

    Remove duplicates.

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

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  15. def exists(f: (A) ⇒ Boolean): Boolean

    Check whether at least one element satisfies the predicate.

    Check whether at least one element satisfies the predicate.

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  16. def filter(f: (A) ⇒ Boolean): Vector[A]

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

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

    Find the first element matching the predicate, if one exists

    Find the first element matching the predicate, if one exists

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  19. def flatMap[B](f: (A) ⇒ NonEmptyVector[B]): NonEmptyVector[B]

    Applies f to all elements and combines the result

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

    Left-associative fold using f.

    Left-associative fold using f.

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  21. def foldRight[B](lb: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B]): Eval[B]

    Right-associative fold using f.

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

    Check whether all elements satisfy the predicate.

    Check whether all elements satisfy the predicate.

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  23. def get(i: Int): Option[A]

    Gets the element at the index, if it exists

  24. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  25. def getUnsafe(i: Int): A

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

  26. final def groupBy[B](f: (A) ⇒ B)(implicit B: Order[B]): SortedMap[B, NonEmptyVector[A]]

    Groups elements inside this NonEmptyVector according to the Order of the keys produced by the given mapping function.

    Groups elements inside this NonEmptyVector according to the Order of the keys produced by the given mapping function.

    scala> import scala.collection.immutable.SortedMap
    scala> import cats.data.NonEmptyVector
    scala> import cats.implicits._
    scala> val nev = NonEmptyVector.of(12, -2, 3, -5)
    scala> val expectedResult = SortedMap(false -> NonEmptyVector.of(-2, -5), true -> NonEmptyVector.of(12, 3))
    scala> val result = nev.groupBy(_ >= 0)
    scala> result === expectedResult
    res0: Boolean = true
  27. final def groupByNem[B](f: (A) ⇒ B)(implicit B: Order[B]): NonEmptyMap[B, NonEmptyVector[A]]

    Groups elements inside this NonEmptyVector according to the Order of the keys produced by the given mapping function.

    Groups elements inside this NonEmptyVector according to the Order of the keys produced by the given mapping function.

    scala> import cats.data.{NonEmptyMap, NonEmptyVector}
    scala> import cats.implicits._
    scala> val nel = NonEmptyVector.of(12, -2, 3, -5)
    scala> val expectedResult = NonEmptyMap.of(false -> NonEmptyVector.of(-2, -5), true -> NonEmptyVector.of(12, 3))
    scala> val result = nel.groupByNem(_ >= 0)
    scala> result === expectedResult
    res0: Boolean = true
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  28. def head: A
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  29. def init: Vector[A]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. final def iterator: Iterator[A]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  32. def last: A
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  33. def length: Int
  34. def map[B](f: (A) ⇒ B): NonEmptyVector[B]

    Applies f to all the elements

    Applies f to all the elements

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  35. def prepend[AA >: A](a: AA): NonEmptyVector[AA]

    Prepend an item to this, producing a new NonEmptyVector.

    Prepend an item to this, producing a new NonEmptyVector.

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  36. def prependVector[AA >: A](vector: Vector[AA]): NonEmptyVector[AA]

    Prepend a Vector to this, producing a new NonEmptyVector.

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

    Reduce using the Semigroup of A

    Reduce using the Semigroup of A

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  38. def reduceLeft[AA >: A](f: (AA, AA) ⇒ AA): AA

    Left-associative reduce using f.

  39. def reverse: NonEmptyVector[A]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  40. def show[AA >: A](implicit AA: Show[AA]): String

    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.

    Definition Classes
    NonEmptyVector → NonEmptyCollection
  41. def sortBy[B](f: (A) ⇒ B)(implicit B: Order[B]): NonEmptyVector[A]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  42. def sorted[AA >: A](implicit AA: Order[AA]): NonEmptyVector[AA]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  43. def tail: Vector[A]
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  44. final def toNem[T, U](implicit ev: <:<[A, (T, U)], order: Order[T]): NonEmptyMap[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.{NonEmptyMap, NonEmptyVector}
    scala> import cats.implicits._
    scala> val nev = NonEmptyVector((0, "a"), Vector((1, "b"),(0, "c"), (2, "d")))
    scala> val expectedResult = NonEmptyMap.of(0 -> "c", 1 -> "b", 2 -> "d")
    scala> val result = nev.toNem
    scala> result === expectedResult
    res0: Boolean = true
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  45. final def toNes[B >: A](implicit order: Order[B]): NonEmptySet[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 nev = NonEmptyVector(1, Vector(2,2,3,4))
    scala> nev.toNes
    res0: cats.data.NonEmptySet[Int] = TreeSet(1, 2, 3, 4)
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  46. def toString(): String
    Definition Classes
    NonEmptyVector → Any
  47. val toVector: Vector[A]
  48. def updated[AA >: A](i: Int, a: AA): Option[NonEmptyVector[AA]]

    Updates the element at the index, if it exists

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

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

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

    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)(_.toString + _)
    res0: cats.data.NonEmptyVector[String] = NonEmptyVector(1A, 2B, 3C)
    Definition Classes
    NonEmptyVector → NonEmptyCollection
  51. def zipWithIndex: NonEmptyVector[(A, Int)]
    Definition Classes
    NonEmptyVector → NonEmptyCollection

Inherited from NonEmptyCollection[A, Vector, NonEmptyVector]

Inherited from AnyVal

Inherited from Any

Ungrouped