public static class ImmutableBitSet.Builder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private long[] |
words |
Modifier | Constructor and Description |
---|---|
private |
Builder(long[] words) |
Modifier and Type | Method and Description |
---|---|
ImmutableBitSet.Builder |
addAll(ImmutableBitSet bitSet)
Sets all bits in a given bit set.
|
ImmutableBitSet.Builder |
addAll(ImmutableIntList integers)
Sets all bits in a given list of
int s. |
ImmutableBitSet.Builder |
addAll(java.lang.Iterable<java.lang.Integer> integers)
Sets all bits in a given list of bits.
|
ImmutableBitSet |
build()
Builds an ImmutableBitSet from the contents of this Builder.
|
ImmutableBitSet |
build(ImmutableBitSet bitSet)
Builds an ImmutableBitSet from the contents of this Builder, using
an existing ImmutableBitSet if it happens to have the same contents.
|
int |
cardinality()
Returns the number of set bits.
|
ImmutableBitSet.Builder |
clear(int bit) |
void |
intersect(ImmutableBitSet that) |
boolean |
isEmpty() |
ImmutableBitSet.Builder |
removeAll(ImmutableBitSet bitSet)
Clears all bits in a given bit set.
|
ImmutableBitSet.Builder |
set(int bit) |
ImmutableBitSet.Builder |
set(int fromIndex,
int toIndex)
Sets a range of bits, from
from to to - 1. |
private void |
trim(int wordCount) |
boolean |
wouldEqual(ImmutableBitSet bitSet)
Returns whether the bit set that would be created by this Builder would
equal a given bit set.
|
public ImmutableBitSet build()
After calling this method, the Builder cannot be used again.
public ImmutableBitSet build(ImmutableBitSet bitSet)
Supplying the existing bit set if useful for set operations, where there is a significant chance that the original bit set is unchanged. We save memory because we use the same copy. For example:
ImmutableBitSet primeNumbers; ImmutableBitSet hundreds = ImmutableBitSet.of(100, 200, 300); return primeNumbers.except(hundreds);
After calling this method, the Builder cannot be used again.
public ImmutableBitSet.Builder set(int bit)
private void trim(int wordCount)
public ImmutableBitSet.Builder clear(int bit)
public boolean wouldEqual(ImmutableBitSet bitSet)
public int cardinality()
public ImmutableBitSet.Builder addAll(ImmutableBitSet bitSet)
public ImmutableBitSet.Builder addAll(java.lang.Iterable<java.lang.Integer> integers)
public ImmutableBitSet.Builder addAll(ImmutableIntList integers)
int
s.public ImmutableBitSet.Builder removeAll(ImmutableBitSet bitSet)
public ImmutableBitSet.Builder set(int fromIndex, int toIndex)
from
to to
- 1.public boolean isEmpty()
public void intersect(ImmutableBitSet that)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.