scala.collection.immutable.Set

Set2

class Set2[A] extends Set[A]

An optimized representation for immutable sets of size 2

source: Set.scala
Inherited
  1. Hide All
  2. Show all
  1. Set
  2. Set
  3. SetLike
  4. Subtractable
  5. Addable
  6. GenericSetTemplate
  7. Function1
  8. Iterable
  9. Iterable
  10. IterableLike
  11. Equals
  12. Traversable
  13. Immutable
  14. Traversable
  15. GenericTraversableTemplate
  16. TraversableLike
  17. TraversableOnce
  18. FilterMonadic
  19. HasNewBuilder
  20. AnyRef
  21. Any
Visibility
  1. Public
  2. All

Instance constructors

  1. new Set2(elem1: A, elem2: A)

Type Members

  1. type Self = Set[A]

    The type implementing this traversable

  2. class WithFilter extends FilterMonadic[A, Repr]

    A class supporting filtered operations.

Value Members

  1. def !=(arg0: AnyRef): Boolean

  2. def !=(arg0: Any): Boolean

    o != arg0 is the same as !(o == (arg0)).

  3. def ##(): Int

  4. def $asInstanceOf[T0](): T0

  5. def $isInstanceOf[T0](): Boolean

  6. def &(that: Set[A]): Set[A]

    Computes the intersection between this set and another set.

  7. def &~(that: Set[A]): Set[A]

    The difference of this set and another set.

  8. def **(that: Set[A]): Set[A]

    This method is an alias for intersect.

  9. def +(elem: A): Set[A]

    Creates a new set with an additional element, unless the element is already present.

  10. def +(elem1: A, elem2: A, elems: A*): Set[A]

    Creates a new immutable set with additional elements.

  11. def ++(xs: TraversableOnce[A]): Set[A]

    Creates a new immutable set by adding all elements contained in another collection to this immutable set.

  12. def ++(that: TraversableOnce[A]): Traversable[A]

    [use case] Concatenates this immutable set with the elements of a traversable collection.

  13. def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Set[A], B, That]): That

    Concatenates this immutable set with the elements of a traversable collection.

  14. def -(elem: A): Set[A]

    Creates a new set with a given element removed from this set.

  15. def -(elem1: A, elem2: A, elems: A*): Set[A]

    Creates a new immutable set from this immutable set with some elements removed.

  16. def --(xs: TraversableOnce[A]): Set[A]

    Creates a new immutable set from this immutable set by removing all elements of another collection.

  17. def /:[B](z: B)(op: (B, A) ⇒ B): B

    Applies a binary operator to a start value and all elements of this immutable set, going left to right.

  18. def :\[B](z: B)(op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this immutable set and a start value, going right to left.

  19. def ==(arg0: AnyRef): Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

  20. def ==(arg0: Any): Boolean

    o == arg0 is the same as o.equals(arg0).

  21. def addString(b: StringBuilder): StringBuilder

    Appends all elements of this immutable set to a string builder.

  22. def addString(b: StringBuilder, sep: String): StringBuilder

    Appends all elements of this immutable set to a string builder using a separator string.

  23. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Appends all elements of this immutable set to a string builder using start, end, and separator strings.

  24. def andThen[A](g: (Boolean) ⇒ A): (A) ⇒ A

    (f andThen g)(x) == g(f(x))

  25. def apply(elem: A): Boolean

    Tests if some element is contained in this set.

  26. def asInstanceOf[T0]: T0

    This method is used to cast the receiver object to be of type T0.

  27. def canEqual(that: Any): Boolean

    Method called from equality methods, so that user-defined subclasses can refuse to be equal to other collections of the same kind.

  28. def clone(): AnyRef

    This method creates and returns a copy of the receiver object.

  29. def collect[B](pf: PartialFunction[A, B]): Traversable[B]

    [use case] Builds a new collection by applying a partial function to all elements of this immutable set on which the function is defined.

  30. def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Set[A], B, That]): That

    Builds a new collection by applying a partial function to all elements of this immutable set on which the function is defined.

  31. def companion: GenericCompanion[Set[A][A]]

    The factory companion object that builds instances of class immutable.

  32. def compose[A](g: (A) ⇒ A): (A) ⇒ Boolean

    (f compose g)(x) == f(g(x))

  33. def contains(elem: A): Boolean

    Tests if some element is contained in this set.

  34. def copyToArray(xs: Array[A], start: Int, len: Int): Unit

    [use case] Copies elements of this immutable set to an array.

  35. def copyToArray[B >: A](xs: Array[B], start: Int, len: Int): Unit

    Copies elements of this immutable set to an array.

  36. def copyToArray(xs: Array[A]): Unit

    [use case] Copies values of this immutable set to an array.

  37. def copyToArray[B >: A](xs: Array[B]): Unit

    Copies values of this immutable set to an array.

  38. def copyToArray(xs: Array[A], start: Int): Unit

    [use case] Copies values of this immutable set to an array.

  39. def copyToArray[B >: A](xs: Array[B], start: Int): Unit

    Copies values of this immutable set to an array.

  40. def copyToBuffer[B >: A](dest: Buffer[B]): Unit

    Copies all elements of this immutable set to a buffer.

  41. def count(p: (A) ⇒ Boolean): Int

    Counts the number of elements in the immutable set which satisfy a predicate.

  42. def diff(that: Set[A]): Set[A]

    Computes the difference of this set and another set.

  43. def drop(n: Int): Set[A]

    Selects all elements except first n ones.

  44. def dropRight(n: Int): Set[A]

    Selects all elements except last n ones.

  45. def dropWhile(p: (A) ⇒ Boolean): Set[A]

    Drops longest prefix of elements that satisfy a predicate.

  46. def elements: Iterator[A]

  47. def empty: Set[A]

  48. def eq(arg0: AnyRef): Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

  49. def equals(that: Any): Boolean

    Compares this set with another object for equality.

  50. def exists(p: (A) ⇒ Boolean): Boolean

    Tests whether a predicate holds for some of the elements of this immutable set.

  51. def filter(p: (A) ⇒ Boolean): Set[A]

    Selects all elements of this immutable set which satisfy a predicate.

  52. def filterNot(p: (A) ⇒ Boolean): Set[A]

    Selects all elements of this immutable set which do not satisfy a predicate.

  53. def finalize(): Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

  54. def find(p: (A) ⇒ Boolean): Option[A]

    Finds the first element of the immutable set satisfying a predicate, if any.

  55. def first: A

  56. def firstOption: Option[A]

    None if iterable is empty.

  57. def flatMap[B](f: (A) ⇒ Traversable[B]): Traversable[B]

    [use case] Builds a new collection by applying a function to all elements of this immutable set and concatenating the results.

  58. def flatMap[B, That](f: (A) ⇒ Traversable[B])(implicit bf: CanBuildFrom[Set[A], B, That]): That

    Builds a new collection by applying a function to all elements of this immutable set and concatenating the results.

  59. def flatten[B]: CC[B]

    [use case] Converts this immutable set of traversable collections into a immutable set in which all element collections are concatenated.

  60. def flatten[B](implicit asTraversable: (A) ⇒ Traversable[B]): Set[B]

    Converts this immutable set of traversable collections into a immutable set in which all element collections are concatenated.

  61. def foldLeft[B](z: B)(op: (B, A) ⇒ B): B

    Applies a binary operator to a start value and all elements of this immutable set, going left to right.

  62. def foldRight[B](z: B)(op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this immutable set and a start value, going right to left.

  63. def forall(p: (A) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all elements of this immutable set.

  64. def foreach(f: (A) ⇒ Unit): Unit

    [use case] Applies a function f to all elements of this immutable set.

  65. def foreach[U](f: (A) ⇒ U): Unit

    Applies a function f to all elements of this immutable set.

  66. def genericBuilder[B]: Builder[B, Set[B]]

    The generic builder that builds instances of immutable.

  67. def getClass(): java.lang.Class[_ <: java.lang.Object]

    Returns a representation that corresponds to the dynamic class of the receiver object.

  68. def groupBy[K](f: (A) ⇒ K): Map[K, Set[A]]

    Partitions this immutable set into a map of immutable sets according to some discriminator function.

  69. def grouped(size: Int): Iterator[Set[A]]

    Partitions elements in fixed size immutable sets.

  70. def hasDefiniteSize: Boolean

    Tests whether this immutable set is known to have a finite size.

  71. def hashCode(): Int

    Returns a hash code value for the object.

  72. def head: A

    Selects the first element of this immutable set.

  73. def headOption: Option[A]

    Optionally selects the first element.

  74. def init: Set[A]

    Selects all elements except the last.

  75. def intersect(that: Set[A]): Set[A]

    Computes the intersection between this set and another set.

  76. def isEmpty: Boolean

    Tests if this set is empty.

  77. def isInstanceOf[T0]: Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

  78. def isTraversableAgain: Boolean

    Tests whether this immutable set can be repeatedly traversed.

  79. def iterator: Iterator[A]

    Creates a new iterator over all elements contained in this iterable object.

  80. def last: A

    Selects the last element.

  81. def lastOption: Option[A]

    Optionally selects the last element.

  82. def map[B](f: (A) ⇒ B): Traversable[B]

    [use case] Builds a new collection by applying a function to all elements of this immutable set.

  83. def map[B, That](f: (A) ⇒ B)(implicit bf: CanBuildFrom[Set[A], B, That]): That

    Builds a new collection by applying a function to all elements of this immutable set.

  84. def max: A

    [use case] Finds the largest element.

  85. def max[B >: A](implicit cmp: Ordering[B]): A

    Finds the largest element.

  86. def min: A

    [use case] Finds the smallest element.

  87. def min[B >: A](implicit cmp: Ordering[B]): A

    Finds the smallest element.

  88. def mkString: String

    Displays all elements of this immutable set in a string.

  89. def mkString(sep: String): String

    Displays all elements of this immutable set in a string using a separator string.

  90. def mkString(start: String, sep: String, end: String): String

    Displays all elements of this immutable set in a string using start, end, and separator strings.

  91. def ne(arg0: AnyRef): Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

  92. def newBuilder: Builder[A, Set[A]]

    A common implementation of newBuilder for all sets in terms of empty.

  93. def nonEmpty: Boolean

    Tests whether the immutable set is not empty.

  94. def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

  95. def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

  96. def partition(p: (A) ⇒ Boolean): (Set[A], Set[A])

    Partitions this immutable set in two immutable sets according to a predicate.

  97. def product: Int

    [use case] Multiplies up the elements of this collection.

  98. def product[B >: A](implicit num: Numeric[B]): B

    Multiplies up the elements of this collection.

  99. def projection: IterableView[A, Set[A]]

    returns a projection that can be used to call non-strict filter,map, and flatMap methods that build projections of the collection.

  100. def reduceLeft[B >: A](op: (B, A) ⇒ B): B

    Applies a binary operator to all elements of this immutable set, going left to right.

  101. def reduceLeftOption[B >: A](op: (B, A) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this immutable set, going left to right.

  102. def reduceRight[B >: A](op: (A, B) ⇒ B): B

    Applies a binary operator to all elements of this immutable set, going right to left.

  103. def reduceRightOption[B >: A](op: (A, B) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this immutable set, going right to left.

  104. def repr: Set[A]

    The collection of type immutable set underlying this TraversableLike object.

  105. def reversed: List[A]

  106. def sameElements(that: Iterable[A]): Boolean

    [use case] Checks if the other iterable collection contains the same elements in the same order as this immutable set.

  107. def sameElements[B >: A](that: Iterable[B]): Boolean

    Checks if the other iterable collection contains the same elements in the same order as this immutable set.

  108. def scanLeft[B, That](z: B)(op: (B, A) ⇒ B)(implicit bf: CanBuildFrom[Set[A], B, That]): That

    Produces a collection containing cummulative results of applying the operator going left to right.

  109. def scanRight[B, That](z: B)(op: (A, B) ⇒ B)(implicit bf: CanBuildFrom[Set[A], B, That]): That

    Produces a collection containing cummulative results of applying the operator going right to left.

  110. def size: Int

    The size of this immutable set.

  111. def slice(from: Int, until: Int): Set[A]

    Selects an interval of elements.

  112. def sliding[B >: A](size: Int, step: Int): Iterator[Set[A]]

  113. def sliding[B >: A](size: Int): Iterator[Set[A]]

    Groups elements in fixed size blocks by passing a "sliding window" over them (as opposed to partitioning them, as is done in grouped.

  114. def span(p: (A) ⇒ Boolean): (Set[A], Set[A])

    Splits this immutable set into a prefix/suffix pair according to a predicate.

  115. def splitAt(n: Int): (Set[A], Set[A])

    Splits this immutable set into two at a given position.

  116. def stringPrefix: String

    Defines the prefix of this object's toString representation.

  117. def subsetOf(that: Set[A]): Boolean

    Tests whether this set is a subset of another set.

  118. def sum: Int

    [use case] Sums up the elements of this collection.

  119. def sum[B >: A](implicit num: Numeric[B]): B

    Sums up the elements of this collection.

  120. def synchronized[T0](arg0: T0): T0

  121. def tail: Set[A]

    Selects all elements except the first.

  122. def take(n: Int): Set[A]

    Selects first n elements.

  123. def takeRight(n: Int): Set[A]

    Selects last n elements.

  124. def takeWhile(p: (A) ⇒ Boolean): Set[A]

    Takes longest prefix of elements that satisfy a predicate.

  125. def thisCollection: Iterable[A]

    The underlying collection seen as an instance of immutable.Set.

  126. def toArray: Array[A]

    [use case] Converts this immutable set to an array.

  127. def toArray[B >: A](implicit arg0: ClassManifest[B]): Array[B]

    Converts this immutable set to an array.

  128. def toBuffer[B >: A]: Buffer[B]

    Converts this immutable set to a mutable buffer.

  129. def toCollection(repr: Set[A]): Iterable[A]

    A conversion from collections of type Repr to immutable.Set objects.

  130. def toIndexedSeq[B >: A]: IndexedSeq[B]

    Converts this immutable set to an indexed sequence.

  131. def toIterable: Iterable[A]

    Converts this immutable set to an iterable collection.

  132. def toIterator: Iterator[A]

    Returns an Iterator over the elements in this immutable set.

  133. def toList: List[A]

    Converts this immutable set to a list.

  134. def toMap[T, U](implicit ev: <:<[A, (T, U)]): Map[T, U]

    Converts this immutable set to a map.

  135. def toSeq: Seq[A]

    Converts this immutable set to a sequence.

  136. def toSet[B >: A]: Set[B]

    Converts this immutable set to a set.

  137. def toStream: Stream[A]

    Converts this immutable set to a stream.

  138. def toString(): String

    Converts this immutable set to a string.

  139. def toTraversable: Traversable[A]

    Converts this immutable set to an unspecified Traversable.

  140. def transpose[B](implicit asTraversable: (A) ⇒ Traversable[B]): Set[Set[B]]

    Transposes this immutable set of traversable collections into a immutable set of immutable sets.

  141. def union(that: Set[A]): Set[A]

    Computes the union between of set and another set.

  142. def unzip[A1, A2](implicit asPair: (A) ⇒ (A1, A2)): (Set[A1], Set[A2])

    Converts this immutable set of pairs into two collections of the first and second halfs of each pair.

  143. def view(from: Int, until: Int): IterableView[A, Set[A]]

    Creates a non-strict view of a slice of this immutable set.

  144. def view: IterableView[A, Set[A]]

    Creates a non-strict view of this immutable set.

  145. def wait(): Unit

  146. def wait(arg0: Long, arg1: Int): Unit

  147. def wait(arg0: Long): Unit

  148. def withFilter(p: (A) ⇒ Boolean): FilterMonadic[A, Set[A]]

    Creates a non-strict filter of this immutable set.

  149. def zip[B](that: Iterable[B]): Iterable[(A, B)]

    [use case] Returns a immutable set formed from this immutable set and another iterable collection by combining corresponding elements in pairs.

  150. def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[Set[A], (A1, B), That]): That

    Returns a immutable set formed from this immutable set and another iterable collection by combining corresponding elements in pairs.

  151. def zipAll[B](that: Iterable[B], thisElem: A, thatElem: B): Iterable[(A, B)]

    [use case] Returns a immutable set formed from this immutable set and another iterable collection by combining corresponding elements in pairs.

  152. def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[Set[A], (A1, B), That]): That

    Returns a immutable set formed from this immutable set and another iterable collection by combining corresponding elements in pairs.

  153. def zipWithIndex: Iterable[(A, Int)]

    [use case] Zips this immutable set with its indices.

  154. def zipWithIndex[A1 >: A, That](implicit bf: CanBuildFrom[Set[A], (A1, Int), That]): That

    Zips this immutable set with its indices.

  155. def |(that: Set[A]): Set[A]

    Computes the union between this set and another set.