Class IntHashSet.ImmutableIntHashSet

All Implemented Interfaces:
Serializable, ImmutableIntCollection, IntIterable, PrimitiveIterable, ImmutableIntSet, IntSet
Enclosing class:
IntHashSet

private static final class IntHashSet.ImmutableIntHashSet extends AbstractImmutableIntSet implements Serializable
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • table

      private final int[] table
    • occupied

      private final int occupied
    • zeroToThirtyOne

      private final int zeroToThirtyOne
    • zeroToThirtyOneOccupied

      private final int zeroToThirtyOneOccupied
  • Constructor Details

    • ImmutableIntHashSet

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

    • 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
    • size

      public int size()
      Description copied from interface: PrimitiveIterable
      Returns the number of items in this iterable.
      Specified by:
      size in interface PrimitiveIterable
    • appendString

      public void appendString(Appendable appendable, String start, String separator, String end)
      Description copied from interface: PrimitiveIterable
      Prints a string representation of this collection onto the given Appendable. Prints the string returned by PrimitiveIterable.makeString(String, String, String).
      Specified by:
      appendString in interface PrimitiveIterable
    • 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
    • each

      public void each(IntProcedure procedure)
      Description copied from interface: IntIterable
      A synonym for forEach.
      Specified by:
      each in interface IntIterable
    • select

      public ImmutableIntSet select(IntPredicate predicate)
      Description copied from interface: IntIterable
      Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.
      Specified by:
      select in interface ImmutableIntCollection
      Specified by:
      select in interface ImmutableIntSet
      Specified by:
      select in interface IntIterable
      Specified by:
      select in interface IntSet
    • reject

      public ImmutableIntSet reject(IntPredicate predicate)
      Description copied from interface: IntIterable
      Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.
      Specified by:
      reject in interface ImmutableIntCollection
      Specified by:
      reject in interface ImmutableIntSet
      Specified by:
      reject in interface IntIterable
      Specified by:
      reject in interface IntSet
    • collect

      public <V> ImmutableSet<V> collect(IntToObjectFunction<? extends V> function)
      Description copied from interface: IntIterable
      Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.
      Specified by:
      collect in interface ImmutableIntCollection
      Specified by:
      collect in interface ImmutableIntSet
      Specified by:
      collect in interface IntIterable
      Specified by:
      collect in interface IntSet
    • detectIfNone

      public int detectIfNone(IntPredicate predicate, int ifNone)
      Specified by:
      detectIfNone 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
    • max

      public int max()
      Specified by:
      max in interface IntIterable
    • min

      public int min()
      Specified by:
      min in interface IntIterable
    • injectInto

      public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
      Specified by:
      injectInto in interface IntIterable
    • writeReplace

      private 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)