Class ImmutableBitSet.Builder

    • Field Detail

      • words

        private long[] words
    • Constructor Detail

      • Builder

        private Builder​(long[] words)
    • Method Detail

      • build

        public ImmutableBitSet build()
        Builds an ImmutableBitSet from the contents of this Builder.

        After calling this method, the Builder cannot be used again.

      • buildAndReset

        public ImmutableBitSet buildAndReset()
        Builds an ImmutableBitSet from the contents of this Builder.

        After calling this method, the Builder may be used again.

      • build

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

        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.

      • get

        public boolean get​(int bitIndex)
      • trim

        private void trim​(int wordCount)
      • wouldEqual

        public boolean wouldEqual​(ImmutableBitSet bitSet)
        Returns whether the bit set that would be created by this Builder would equal a given bit set.
      • cardinality

        public int cardinality()
        Returns the number of set bits.
      • addAll

        public ImmutableBitSet.Builder addAll​(java.lang.Iterable<java.lang.Integer> integers)
        Sets all bits in a given list of bits.
      • set

        public ImmutableBitSet.Builder set​(int fromIndex,
                                           int toIndex)
        Sets a range of bits, from from to to - 1.
      • isEmpty

        public boolean isEmpty()