sealed class NonEmptySetOps[A] extends AnyRef
- Annotations
- @suppressUnusedImportWarningForScalaVersionSpecific()
- Source
- NonEmptySet.scala
- Alphabetic
- By Inheritance
- NonEmptySetOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new NonEmptySetOps(value: NonEmptySet[A])
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def &(as: NonEmptySet[A]): SortedSet[A]
Alias for intersect
Alias for intersect
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 4, 5) scala> nes & NonEmptySet.of(1, 2, 7) res0: scala.collection.immutable.SortedSet[Int] = TreeSet(1, 2)
- def &~(as: NonEmptySet[A]): SortedSet[A]
Alias for diff
Alias for diff
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 4, 5) scala> nes &~ NonEmptySet.of(1, 2, 7) res0: scala.collection.immutable.SortedSet[Int] = TreeSet(4, 5)
- def ++(as: NonEmptySet[A]): NonEmptySet[A]
Alias for union
Alias for union
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 4, 5) scala> nes ++ NonEmptySet.of(1, 2, 7) res0: cats.data.NonEmptySet[Int] = TreeSet(1, 2, 4, 5, 7)
- def -(a: A): SortedSet[A]
Removes a key from this set, returning a new
SortedSet
. - def --(as: NonEmptySet[A]): SortedSet[A]
Alias for diff
Alias for diff
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 4, 5) scala> nes -- NonEmptySet.of(1, 2, 7) res0: scala.collection.immutable.SortedSet[Int] = TreeSet(4, 5)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ===(that: NonEmptySet[A]): Boolean
Typesafe equality operator.
Typesafe equality operator.
This method is similar to == except that it only allows two NonEmptySet[A] values to be compared to each other, and uses equality provided by Eq[_] instances, rather than using the universal equality provided by .equals.
- def add(a: A): NonEmptySet[A]
Adds an element to this set, returning a new
NonEmptySet
- def apply(a: A): Boolean
Alias for contains
Alias for contains
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 3, 4, 5) scala> nes(3) res0: Boolean = true scala> nes(7) res1: Boolean = false
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def collect[B](pf: PartialFunction[A, B])(implicit B: kernel.Order[B]): SortedSet[B]
Returns a new
SortedSet
containing all elements where the result ofpf
is defined. - def concatMap[B](f: (A) => NonEmptySet[B])(implicit B: kernel.Order[B]): NonEmptySet[B]
Map a function over all the elements of this set and concatenate the resulting sets into one.
Map a function over all the elements of this set and concatenate the resulting sets into one.
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 3) scala> nes.concatMap(n => NonEmptySet.of(n, n * 4, n * 5)) res0: cats.data.NonEmptySet[Int] = TreeSet(1, 2, 3, 4, 5, 8, 10, 12, 15)
- def contains(a: A): Boolean
Tests if some element is contained in this set.
- def diff(as: NonEmptySet[A]): SortedSet[A]
Computes the difference of this set and another set.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exists(f: (A) => Boolean): Boolean
Tests whether a predicate holds for at least one element of this set.
- def filter(p: (A) => Boolean): SortedSet[A]
Filters all elements of this set that do not satisfy the given predicate.
- def filterNot(p: (A) => Boolean): SortedSet[A]
Filters all elements of this set that satisfy the given predicate.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def find(f: (A) => Boolean): Option[A]
Returns the first value that matches the given predicate.
- def foldLeft[B](b: B)(f: (B, A) => B): B
Left-associative fold using f.
- def foldRight[B](lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B]
Right-associative fold using f.
- def forall(p: (A) => Boolean): Boolean
Tests whether a predicate holds for all elements of this set.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def groupBy[B](f: (A) => B)(implicit B: kernel.Order[B]): NonEmptyMap[B, NonEmptySet[A]]
Groups elements inside this
NonEmptySet
according to theOrder
of the keys produced by the given mapping function. - def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def head: A
Returns the first element of this set.
- def intersect(as: NonEmptySet[A]): SortedSet[A]
Computes the intersection between this set and another set.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def last: A
Returns the last element of this set.
- def length: Int
Returns the number of elements in this set.
- def map[B](f: (A) => B)(implicit B: kernel.Order[B]): NonEmptySet[B]
Applies f to all the elements
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def reduce[AA >: A](implicit S: kernel.Semigroup[AA]): AA
Reduce using the Semigroup of A
- def reduceLeft(f: (A, A) => A): A
Left-associative reduce using f.
- def reduceLeftTo[B](f: (A) => B)(g: (B, A) => B): B
Apply
f
to the "initial element" of this set and lazily combine it with every other value using the given functiong
. - def reduceRight(f: (A, Eval[A]) => Eval[A]): Eval[A]
Left-associative reduce using f.
- def reduceRightTo[B](f: (A) => B)(g: (A, Eval[B]) => Eval[B]): Eval[B]
Apply
f
to the "initial element" of this set and lazily combine it with every other value using the given functiong
. - def show(implicit A: Show[A]): 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.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def tail: SortedSet[A]
Returns all but the first element of this set.
- def toNonEmptyList: NonEmptyList[A]
Converts this set to a
NonEmptyList
.Converts this set to a
NonEmptyList
.scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 3, 4, 5) scala> nes.toNonEmptyList res0: cats.data.NonEmptyList[Int] = NonEmptyList(1, 2, 3, 4, 5)
- def toSortedSet: SortedSet[A]
Converts this set to a
SortedSet
- def toString(): String
- Definition Classes
- AnyRef → Any
- def union(as: NonEmptySet[A]): NonEmptySet[A]
Computes the union between this NES and another NES.
- val value: NonEmptySet[A]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def zipWith[B, C](b: NonEmptySet[B])(f: (A, B) => C)(implicit C: kernel.Order[C]): NonEmptySet[C]
Zips this
NonEmptySet
with anotherNonEmptySet
and applies a function for each pair of elements.Zips this
NonEmptySet
with anotherNonEmptySet
and applies a function for each pair of elements.scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val as = NonEmptySet.of(1, 2, 3) scala> val bs = NonEmptySet.of("A", "B", "C") scala> as.zipWith(bs)(_.toString + _) res0: cats.data.NonEmptySet[String] = TreeSet(1A, 2B, 3C)
- def zipWithIndex: NonEmptySet[(A, Int)]
Zips this
NonEmptySet
with its index. - def |(as: NonEmptySet[A]): NonEmptySet[A]
Alias for union
Alias for union
scala> import cats.data.NonEmptySet scala> import cats.implicits._ scala> val nes = NonEmptySet.of(1, 2, 4, 5) scala> nes | NonEmptySet.of(1, 2, 7) res0: cats.data.NonEmptySet[Int] = TreeSet(1, 2, 4, 5, 7)