Packages

c

cats.syntax

SetOps

final class SetOps[A] extends AnyVal

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

Instance Constructors

  1. new SetOps(se: SortedSet[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 groupByNes[B](f: (A) ⇒ B)(implicit B: Order[B]): SortedMap[B, NonEmptySet[A]]

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

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

    scala> import cats.data.NonEmptySet
    scala> import scala.collection.immutable.{SortedMap, SortedSet}
    scala> import cats.implicits._
    
    scala> val sortedSet = SortedSet(12, -2, 3, -5)
    
    scala> val expectedResult = SortedMap(false -> NonEmptySet.of(-5, -2), true -> NonEmptySet.of(3, 12))
    
    scala> sortedSet.groupByNes(_ >= 0) === expectedResult
    res0: Boolean = true
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. def toNes: Option[NonEmptySet[A]]

    Returns an Option of NonEmptySet from a SortedSet

    Returns an Option of NonEmptySet from a SortedSet

    Example:

    scala> import scala.collection.immutable.SortedSet
    scala> import cats.data.NonEmptySet
    scala> import cats.implicits._
    
    scala> val result1: SortedSet[Int] = SortedSet(1, 2)
    scala> result1.toNes
    res0: Option[NonEmptySet[Int]] = Some(TreeSet(1, 2))
    
    scala> val result2: SortedSet[Int] = SortedSet.empty[Int]
    scala> result2.toNes
    res1: Option[NonEmptySet[Int]] = None
  9. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped