Class ImmutableBitSet.Rebuilder

    • Constructor Detail

    • Method Detail

      • build

        public ImmutableBitSet build​(ImmutableBitSet bitSet)
        Description copied from class: ImmutableBitSet.Builder
        Builds an ImmutableBitSet from the contents of this Builder, using an existing ImmutableBitSet if it happens to have the same contents.

        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.

        Overrides:
        build in class ImmutableBitSet.Builder