Class ImmutableBitSet.Builder
java.lang.Object
com.google.mu.collect.ImmutableBitSet.Builder
- Enclosing class:
ImmutableBitSet
Builder of
ImmutableBitSet.- Since:
- 11.4
-
Method Summary
Modifier and TypeMethodDescriptionand(ImmutableBitSet that) Clears the bits that aren't set inthat, likeBitSet.and(BitSet).andNot(ImmutableBitSet that) Clears the bits that are set inthat, likeBitSet.andNot(BitSet).build()Returns an immutable set of the bits set so far.clear(int index) Clears the bit atindex.clear(int fromIndex, int toIndex) booleanisEmpty()Returns true if no bit is set.or(ImmutableBitSet that) Sets the bits that are set inthat, likeBitSet.or(BitSet).set(int index) Sets the bit atindex.set(int index, boolean value) set(int fromIndex, int toIndex) xor(ImmutableBitSet that) Flips the bits that are set inthat, likeBitSet.xor(BitSet).
-
Method Details
-
set
Sets the bit atindex. Setting a bit that is already set has no effect.- Returns:
- this builder
- Throws:
IndexOutOfBoundsException- ifindexis negative
-
set
- Returns:
- this builder
- Throws:
IndexOutOfBoundsException- ifindexis negative
-
set
- Returns:
- this builder
- Throws:
IndexOutOfBoundsException- iffromIndexis negative,toIndexis negative, orfromIndex > toIndex
-
clear
Clears the bit atindex. Clearing a bit that is already cleared has no effect.- Returns:
- this builder
- Throws:
IndexOutOfBoundsException- ifindexis negative
-
clear
- Returns:
- this builder
- Throws:
IndexOutOfBoundsException- iffromIndexis negative,toIndexis negative, orfromIndex > toIndex
-
and
Clears the bits that aren't set inthat, likeBitSet.and(BitSet).- Returns:
- this builder
-
or
Sets the bits that are set inthat, likeBitSet.or(BitSet).- Returns:
- this builder
-
xor
Flips the bits that are set inthat, likeBitSet.xor(BitSet).- Returns:
- this builder
-
andNot
Clears the bits that are set inthat, likeBitSet.andNot(BitSet).- Returns:
- this builder
-
isEmpty
public boolean isEmpty()Returns true if no bit is set. -
build
Returns an immutable set of the bits set so far.
-