scala.collection.immutable

BitSet

class BitSet extends Set[Int] with BitSet with BitSetLike[BitSet]

A class for immutable bitsets.

Bitsets are sets of non-negative integers which are represented as variable-size arrays of bits packed into 64-bit words. The memory footprint of a bitset is determined by the largest number stored in it.

attributes: abstract
go to: companion
known subclasses: BitSetN, BitSet2, BitSet1
source: BitSet.scala
    version
  1. 2.8

    since
  1. 2.8

    authors:
  1. Martin Odersky

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

Instance constructors

  1. new BitSet()

Type Members

  1. type Self = BitSet

    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 &(other: BitSet): BitSet

    Computes the intersection between this bitset and another bitset by performing a bitwise "and".

  7. def &(that: Set[Int]): BitSet

    Computes the intersection between this set and another set.

  8. def &~(other: BitSet): BitSet

    Computes the difference of this bitset and another bitset by performing a bitwise "and-not".

  9. def &~(that: Set[Int]): BitSet

    The difference of this set and another set.

  10. def **(that: Set[Int]): BitSet

    This method is an alias for intersect.

  11. def +(elem: Int): BitSet

    Adds element to bitset, returning a new set.

  12. def +(elem1: Int, elem2: Int, elems: Int*): BitSet

    Creates a new immutable bitset with additional elements.

  13. def ++(xs: TraversableOnce[Int]): BitSet

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

  14. def ++(that: TraversableOnce[Int]): Traversable[Int]

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

  15. def ++[B >: Int, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[BitSet, B, That]): That

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

  16. def -(elem: Int): BitSet

    Removes element from bitset, returning a new set@param elem the element to be removed

  17. def -(elem1: Int, elem2: Int, elems: Int*): BitSet

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

  18. def --(xs: TraversableOnce[Int]): BitSet

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

  19. def /:[B](z: B)(op: (B, Int) ⇒ B): B

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

  20. def :\[B](z: B)(op: (Int, B) ⇒ B): B

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

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

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

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

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

  23. def ^(other: BitSet): BitSet

    Computes the symmetric difference of this bitset and another bitset by performing a bitwise "exclusive-or".

  24. def addString(sb: StringBuilder, start: String, sep: String, end: String): StringBuilder

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

  25. def addString(b: StringBuilder): StringBuilder

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

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

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

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

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

  28. def apply(elem: Int): Boolean

    Tests if some element is contained in this set.

  29. def asInstanceOf[T0]: T0

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

  30. 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.

  31. def clone(): AnyRef

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

  32. def collect[B](pf: PartialFunction[Int, B]): Traversable[B]

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

  33. def collect[B, That](pf: PartialFunction[Int, B])(implicit bf: CanBuildFrom[BitSet, B, That]): That

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

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

    The factory companion object that builds instances of class immutable.

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

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

  36. def contains(elem: Int): Boolean

    Tests if some element is contained in this set.

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

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

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

    Copies elements of this immutable bitset to an array.

  39. def copyToArray(xs: Array[Int]): Unit

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

  40. def copyToArray[B >: Int](xs: Array[B]): Unit

    Copies values of this immutable bitset to an array.

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

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

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

    Copies values of this immutable bitset to an array.

  43. def copyToBuffer[B >: Int](dest: Buffer[B]): Unit

    Copies all elements of this immutable bitset to a buffer.

  44. def count(p: (Int) ⇒ Boolean): Int

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

  45. def diff(that: Set[Int]): BitSet

    Computes the difference of this set and another set.

  46. def drop(n: Int): BitSet

    Selects all elements except first n ones.

  47. def dropRight(n: Int): BitSet

    Selects all elements except last n ones.

  48. def dropWhile(p: (Int) ⇒ Boolean): BitSet

    Drops longest prefix of elements that satisfy a predicate.

  49. def elements: Iterator[Int]

  50. def empty: BitSet

    The empty set of the same type as this set

  51. def eq(arg0: AnyRef): Boolean

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

  52. def equals(that: Any): Boolean

    Compares this set with another object for equality.

  53. def exists(p: (Int) ⇒ Boolean): Boolean

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

  54. def filter(p: (Int) ⇒ Boolean): BitSet

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

  55. def filterNot(p: (Int) ⇒ Boolean): BitSet

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

  56. 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.

  57. def find(p: (Int) ⇒ Boolean): Option[Int]

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

  58. def first: Int

  59. def firstOption: Option[Int]

    None if iterable is empty.

  60. def flatMap[B](f: (Int) ⇒ Traversable[B]): Traversable[B]

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

  61. def flatMap[B, That](f: (Int) ⇒ Traversable[B])(implicit bf: CanBuildFrom[BitSet, B, That]): That

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

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

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

  63. def flatten[B](implicit asTraversable: (Int) ⇒ Traversable[B]): Set[B]

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

  64. def foldLeft[B](z: B)(op: (B, Int) ⇒ B): B

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

  65. def foldRight[B](z: B)(op: (Int, B) ⇒ B): B

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

  66. def forall(p: (Int) ⇒ Boolean): Boolean

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

  67. def foreach(f: (Int) ⇒ Unit): Unit

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

  68. def foreach[B](f: (Int) ⇒ B): Unit

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

  69. def fromArray(elems: Array[Long]): BitSet

    Creates a new set of this kind from an array of longs

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

    The generic builder that builds instances of immutable.

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

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

  72. def groupBy[K](f: (Int) ⇒ K): Map[K, BitSet]

    Partitions this immutable bitset into a map of immutable bitsets according to some discriminator function.

  73. def grouped(size: Int): Iterator[BitSet]

    Partitions elements in fixed size immutable bitsets.

  74. def hasDefiniteSize: Boolean

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

  75. def hashCode(): Int

    Returns a hash code value for the object.

  76. def head: Int

    Selects the first element of this immutable bitset.

  77. def headOption: Option[Int]

    Optionally selects the first element.

  78. def init: BitSet

    Selects all elements except the last.

  79. def intersect(that: Set[Int]): BitSet

    Computes the intersection between this set and another set.

  80. def isEmpty: Boolean

    Tests if this set is empty.

  81. def isInstanceOf[T0]: Boolean

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

  82. def isTraversableAgain: Boolean

    Tests whether this immutable bitset can be repeatedly traversed.

  83. def iterator: Iterator[Int]

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

  84. def last: Int

    Selects the last element.

  85. def lastOption: Option[Int]

    Optionally selects the last element.

  86. def map[B](f: (Int) ⇒ B): Traversable[B]

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

  87. def map[B, That](f: (Int) ⇒ B)(implicit bf: CanBuildFrom[BitSet, B, That]): That

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

  88. def max: Int

    [use case] Finds the largest element.

  89. def max[B >: Int](implicit cmp: Ordering[B]): Int

    Finds the largest element.

  90. def min: Int

    [use case] Finds the smallest element.

  91. def min[B >: Int](implicit cmp: Ordering[B]): Int

    Finds the smallest element.

  92. def mkString: String

    Displays all elements of this immutable bitset in a string.

  93. def mkString(sep: String): String

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

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

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

  95. def ne(arg0: AnyRef): Boolean

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

  96. def newBuilder: Builder[Int, BitSet]

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

  97. def nonEmpty: Boolean

    Tests whether the immutable bitset is not empty.

  98. def notify(): Unit

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

  99. def notifyAll(): Unit

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

  100. def nwords: Int

    The number of words (each with 64 bits) making up the set

  101. def partition(p: (Int) ⇒ Boolean): (BitSet, BitSet)

    Partitions this immutable bitset in two immutable bitsets according to a predicate.

  102. def product: Int

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

  103. def product[B >: Int](implicit num: Numeric[B]): B

    Multiplies up the elements of this collection.

  104. def projection: IterableView[Int, BitSet]

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

  105. def reduceLeft[B >: Int](op: (B, Int) ⇒ B): B

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

  106. def reduceLeftOption[B >: Int](op: (B, Int) ⇒ B): Option[B]

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

  107. def reduceRight[B >: Int](op: (Int, B) ⇒ B): B

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

  108. def reduceRightOption[B >: Int](op: (Int, B) ⇒ B): Option[B]

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

  109. def repr: BitSet

    The collection of type immutable bitset underlying this TraversableLike object.

  110. def reversed: List[Int]

  111. def sameElements(that: Iterable[Int]): Boolean

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

  112. def sameElements[B >: Int](that: Iterable[B]): Boolean

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

  113. def scanLeft[B, That](z: B)(op: (B, Int) ⇒ B)(implicit bf: CanBuildFrom[BitSet, B, That]): That

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

  114. def scanRight[B, That](z: B)(op: (Int, B) ⇒ B)(implicit bf: CanBuildFrom[BitSet, B, That]): That

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

  115. def size: Int

    The size of this immutable bitset.

  116. def slice(from: Int, until: Int): BitSet

    Selects an interval of elements.

  117. def sliding[B >: Int](size: Int, step: Int): Iterator[BitSet]

  118. def sliding[B >: Int](size: Int): Iterator[BitSet]

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

  119. def span(p: (Int) ⇒ Boolean): (BitSet, BitSet)

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

  120. def splitAt(n: Int): (BitSet, BitSet)

    Splits this immutable bitset into two at a given position.

  121. def stringPrefix: String

    Defines the prefix of this object's toString representation.

  122. def subsetOf(other: BitSet): Boolean

    Tests whether this bitset is a subset of another bitset.

  123. def subsetOf(that: Set[Int]): Boolean

    Tests whether this set is a subset of another set.

  124. def sum: Int

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

  125. def sum[B >: Int](implicit num: Numeric[B]): B

    Sums up the elements of this collection.

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

  127. def tail: BitSet

    Selects all elements except the first.

  128. def take(n: Int): BitSet

    Selects first n elements.

  129. def takeRight(n: Int): BitSet

    Selects last n elements.

  130. def takeWhile(p: (Int) ⇒ Boolean): BitSet

    Takes longest prefix of elements that satisfy a predicate.

  131. def thisCollection: Iterable[Int]

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

  132. def toArray: Array[Int]

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

  133. def toArray[B >: Int](implicit arg0: ClassManifest[B]): Array[B]

    Converts this immutable bitset to an array.

  134. def toBuffer[B >: Int]: Buffer[B]

    Converts this immutable bitset to a mutable buffer.

  135. def toCollection(repr: BitSet): Iterable[Int]

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

  136. def toIndexedSeq[B >: Int]: IndexedSeq[B]

    Converts this immutable bitset to an indexed sequence.

  137. def toIterable: Iterable[Int]

    Converts this immutable bitset to an iterable collection.

  138. def toIterator: Iterator[Int]

    Returns an Iterator over the elements in this immutable bitset.

  139. def toList: List[Int]

    Converts this immutable bitset to a list.

  140. def toMap[T, U](implicit ev: <:<[Int, (T, U)]): Map[T, U]

    Converts this immutable bitset to a map.

  141. def toSeq: Seq[Int]

    Converts this immutable bitset to a sequence.

  142. def toSet[B >: Int]: Set[B]

    Converts this immutable bitset to a set.

  143. def toStream: Stream[Int]

    Converts this immutable bitset to a stream.

  144. def toString(): String

    Converts this immutable bitset to a string.

  145. def toTraversable: Traversable[Int]

    Converts this immutable bitset to an unspecified Traversable.

  146. def transpose[B](implicit asTraversable: (Int) ⇒ Traversable[B]): Set[Set[B]]

    Transposes this immutable bitset of traversable collections into a immutable bitset of immutable bitsets.

  147. def union(that: Set[Int]): BitSet

    Computes the union between of set and another set.

  148. def unzip[A1, A2](implicit asPair: (Int) ⇒ (A1, A2)): (Set[A1], Set[A2])

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

  149. def updateWord(idx: Int, w: Long): BitSet

    Update word at index idx; enlarge set if idx outside range of set.

  150. def view(from: Int, until: Int): IterableView[Int, BitSet]

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

  151. def view: IterableView[Int, BitSet]

    Creates a non-strict view of this immutable bitset.

  152. def wait(): Unit

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

  154. def wait(arg0: Long): Unit

  155. def withFilter(p: (Int) ⇒ Boolean): FilterMonadic[Int, BitSet]

    Creates a non-strict filter of this immutable bitset.

  156. def word(idx: Int): Long

    The words at index idx', or 0L if outside the range of the set '''Note:''' requires idx >= 0

  157. def zip[B](that: Iterable[B]): Iterable[(Int, B)]

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

  158. def zip[A1 >: Int, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[BitSet, (A1, B), That]): That

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

  159. def zipAll[B](that: Iterable[B], thisElem: Int, thatElem: B): Iterable[(Int, B)]

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

  160. def zipAll[B, A1 >: Int, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[BitSet, (A1, B), That]): That

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

  161. def zipWithIndex: Iterable[(Int, Int)]

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

  162. def zipWithIndex[A1 >: Int, That](implicit bf: CanBuildFrom[BitSet, (A1, Int), That]): That

    Zips this immutable bitset with its indices.

  163. def |(other: BitSet): BitSet

    Computes the union between this bitset and another bitset by performing a bitwise "or".

  164. def |(that: Set[Int]): BitSet

    Computes the union between this set and another set.