private static class ImmutableBitSet.Rebuilder extends ImmutableBitSet.Builder
ImmutableBitSet.Builder
that remembers its original
ImmutableBitSet
and tries to use it
when build()
is called.Modifier and Type | Field and Description |
---|---|
private ImmutableBitSet |
originalBitSet |
Modifier | Constructor and Description |
---|---|
private |
Rebuilder(ImmutableBitSet originalBitSet) |
Modifier and Type | Method and Description |
---|---|
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.
|
addAll, addAll, addAll, cardinality, clear, intersect, isEmpty, removeAll, set, set, wouldEqual
private final ImmutableBitSet originalBitSet
private Rebuilder(ImmutableBitSet originalBitSet)
public ImmutableBitSet build()
ImmutableBitSet.Builder
After calling this method, the Builder cannot be used again.
build
in class ImmutableBitSet.Builder
public ImmutableBitSet build(ImmutableBitSet bitSet)
ImmutableBitSet.Builder
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.
build
in class ImmutableBitSet.Builder
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.