Packages

c

cats.syntax

VectorOps

final class VectorOps[A] extends AnyVal

Source
vector.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. VectorOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new VectorOps(va: Vector[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  6. def groupByNev[B](f: (A) => B)(implicit B: Order[B]): SortedMap[B, NonEmptyVector[A]]

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

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

    scala> import cats.data.NonEmptyVector
    scala> import scala.collection.immutable.SortedMap
    scala> import cats.implicits._
    
    scala> val vector = Vector(12, -2, 3, -5)
    
    scala> val expectedResult = SortedMap(false -> NonEmptyVector.of(-2, -5), true -> NonEmptyVector.of(12, 3))
    
    scala> vector.groupByNev(_ >= 0) === expectedResult
    res0: Boolean = true
  7. def groupByNevA[F[_], B](f: (A) => F[B])(implicit F: Applicative[F], B: Order[B]): F[SortedMap[B, NonEmptyVector[A]]]

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

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

    scala> import cats.data.NonEmptyVector
    scala> import scala.collection.immutable.SortedMap
    scala> import cats.implicits._
    
    scala> val vector = Vector(12, -2, 3, -5)
    
    scala> val expectedResult = Option(SortedMap(false -> NonEmptyVector.of(-2, -5), true -> NonEmptyVector.of(12, 3)))
    
    scala> vector.groupByNevA(num => Option(0).map(num >= _)) === expectedResult
    res0: Boolean = true
  8. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  9. def scanLeftNev[B](b: B)(f: (B, A) => B): NonEmptyVector[B]

    Produces a NonEmptyVector containing cumulative results of applying the operator going left to right.

    Produces a NonEmptyVector containing cumulative results of applying the operator going left to right.

    Example:

    scala> import cats.data.NonEmptyVector
    scala> import cats.implicits._
    
    scala> val result1: Vector[Int] = Vector(1, 2)
    scala> result1.scanLeftNev(100)(_ + _)
    res0: NonEmptyVector[Int] = NonEmptyVector(100, 101, 103)
    
    scala> val result2: Vector[Int] = Vector.empty[Int]
    scala> result2.scanLeftNev(1)(_ + _)
    res1: NonEmptyVector[Int] = NonEmptyVector(1)
  10. def scanRightNev[B](b: B)(f: (A, B) => B): NonEmptyVector[B]

    Produces a NonEmptyVector containing cumulative results of applying the operator going right to left.

    Produces a NonEmptyVector containing cumulative results of applying the operator going right to left.

    Example:

    scala> import cats.data.NonEmptyVector
    scala> import cats.implicits._
    
    scala> val result1: Vector[Int] = Vector(1, 2)
    scala> result1.scanRightNev(100)(_ + _)
    res0: NonEmptyVector[Int] = NonEmptyVector(103, 102, 100)
    
    scala> val result2: Vector[Int] = Vector.empty[Int]
    scala> result2.scanRightNev(1)(_ + _)
    res1: NonEmptyVector[Int] = NonEmptyVector(1)
  11. def toNev: Option[NonEmptyVector[A]]

    Returns an Option of NonEmptyVector from a Vector

    Returns an Option of NonEmptyVector from a Vector

    Example:

    scala> import cats.data.NonEmptyVector
    scala> import cats.implicits._
    
    scala> val result1: Vector[Int] = Vector(1, 2)
    scala> result1.toNev
    res0: Option[NonEmptyVector[Int]] = Some(NonEmptyVector(1, 2))
    
    scala> val result2: Vector[Int] = Vector.empty[Int]
    scala> result2.toNev
    res1: Option[NonEmptyVector[Int]] = None
  12. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped