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)
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)
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)
Removes a key from this set, returning a new SortedSet
.
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)
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.
Adds an element to this set, returning a new NonEmptySet
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
Returns a new SortedSet
containing all elements where the result of pf
is defined.
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)
Tests if some element is contained in this set.
Computes the difference of this set and another set.
Tests whether a predicate holds for at least one element of this set.
Filters all elements of this set that do not satisfy the given predicate.
Filters all elements of this set that satisfy the given predicate.
Returns the first value that matches the given predicate.
Left-associative fold using f.
Right-associative fold using f.
Tests whether a predicate holds for all elements of this set.
Groups elements inside this NonEmptySet
according to the Order
of the keys produced by the given mapping function.
Returns the first element of this set.
Computes the intersection between this set and another set.
Returns the last element of this set.
Returns the number of elements in this set.
Applies f to all the elements
Reduce using the Semigroup of A
Left-associative reduce using f.
Apply f
to the "initial element" of this set and lazily combine it
with every other value using the given function g
.
Left-associative reduce using f.
Apply f
to the "initial element" of this set and lazily combine it
with every other value using the given function g
.
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.
Returns all but the first element of this set.
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)
Converts this set to a SortedSet
Computes the union between this NES and another NES.
Zips this NonEmptySet
with another NonEmptySet
and applies a function for each pair of elements.
Zips this NonEmptySet
with another NonEmptySet
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)(_ + _) res0: cats.data.NonEmptySet[String] = TreeSet(1A, 2B, 3C)
Zips this NonEmptySet
with its index.
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)