Class IntHashSet.ImmutableIntHashSet

    • Field Detail

      • table

        private final int[] table
      • occupied

        private final int occupied
      • zeroToThirtyOne

        private final int zeroToThirtyOne
      • zeroToThirtyOneOccupied

        private final int zeroToThirtyOneOccupied
    • Constructor Detail

      • ImmutableIntHashSet

        private ImmutableIntHashSet​(int[] table,
                                    int occupied,
                                    int zeroToThirtyOne,
                                    int zeroToThirtyOneOccupied)
    • Method Detail

      • checkOptimizedSize

        private void checkOptimizedSize​(int length)
      • newSetWith

        public static ImmutableIntSet newSetWith​(int... elements)
      • hashCode

        public int hashCode()
        Description copied from interface: IntSet
        Follows the same general contract as Set.hashCode().
        Specified by:
        hashCode in interface IntSet
        Specified by:
        hashCode in class AbstractIntSet
      • intIterator

        public IntIterator intIterator()
        Description copied from interface: IntIterable
        Returns a primitive iterator that can be used to iterate over the IntIterable in an imperative style.
        Specified by:
        intIterator in interface IntIterable
      • toArray

        public int[] toArray()
        Description copied from interface: IntIterable
        Converts the IntIterable to a primitive int array.
        Specified by:
        toArray in interface IntIterable
      • toArray

        public int[] toArray​(int[] array)
        Description copied from interface: IntIterable
        Converts the IntIterable to a primitive int array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.
        Specified by:
        toArray in interface IntIterable
      • contains

        public boolean contains​(int value)
        Description copied from interface: IntIterable
        Returns true if the value is contained in the IntIterable, and false if it is not.
        Specified by:
        contains in interface IntIterable
      • count

        public int count​(IntPredicate predicate)
        Description copied from interface: IntIterable
        Returns a count of the number of elements in the IntIterable that return true for the specified predicate.
        Specified by:
        count in interface IntIterable
      • anySatisfy

        public boolean anySatisfy​(IntPredicate predicate)
        Description copied from interface: IntIterable
        Returns true if any of the elements in the IntIterable return true for the specified predicate, otherwise returns false.
        Specified by:
        anySatisfy in interface IntIterable
      • allSatisfy

        public boolean allSatisfy​(IntPredicate predicate)
        Description copied from interface: IntIterable
        Returns true if all of the elements in the IntIterable return true for the specified predicate, otherwise returns false.
        Specified by:
        allSatisfy in interface IntIterable
      • noneSatisfy

        public boolean noneSatisfy​(IntPredicate predicate)
        Description copied from interface: IntIterable
        Returns true if none of the elements in the IntIterable return true for the specified predicate, otherwise returns false.
        Specified by:
        noneSatisfy in interface IntIterable
      • sum

        public long sum()
        Specified by:
        sum in interface IntIterable
      • writeReplace

        private java.lang.Object writeReplace()
      • probe

        int probe​(int element)
      • probeTwo

        int probeTwo​(int element,
                     int removedIndex)
      • probeThree

        int probeThree​(int element,
                       int removedIndex)
      • spreadAndMask

        int spreadAndMask​(int element)
      • spreadTwoAndMask

        int spreadTwoAndMask​(int element)
      • mask

        private int mask​(int spread)