Class LongHashSet.ImmutableLongHashSet

All Implemented Interfaces:
Serializable, ImmutableLongCollection, LongIterable, PrimitiveIterable, ImmutableLongSet, LongSet
Enclosing class:
LongHashSet

private static final class LongHashSet.ImmutableLongHashSet extends AbstractImmutableLongSet implements Serializable
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • table

      private final long[] table
    • occupied

      private final int occupied
    • zeroToThirtyOne

      private final int zeroToThirtyOne
    • zeroToThirtyOneOccupied

      private final int zeroToThirtyOneOccupied
  • Constructor Details

    • ImmutableLongHashSet

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

    • checkOptimizedSize

      private void checkOptimizedSize(int length)
    • newSetWith

      public static ImmutableLongSet newSetWith(long... elements)
    • hashCode

      public int hashCode()
      Description copied from interface: LongSet
      Follows the same general contract as Set.hashCode().
      Specified by:
      hashCode in interface LongSet
      Specified by:
      hashCode in class AbstractLongSet
    • 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
    • longIterator

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

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

      public long[] toArray(long[] array)
      Description copied from interface: LongIterable
      Converts the LongIterable to a primitive long 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 LongIterable
    • contains

      public boolean contains(long value)
      Description copied from interface: LongIterable
      Returns true if the value is contained in the LongIterable, and false if it is not.
      Specified by:
      contains in interface LongIterable
    • each

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

      public ImmutableLongSet select(LongPredicate predicate)
      Description copied from interface: LongIterable
      Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.
      Specified by:
      select in interface ImmutableLongCollection
      Specified by:
      select in interface ImmutableLongSet
      Specified by:
      select in interface LongIterable
      Specified by:
      select in interface LongSet
    • reject

      public ImmutableLongSet reject(LongPredicate predicate)
      Description copied from interface: LongIterable
      Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.
      Specified by:
      reject in interface ImmutableLongCollection
      Specified by:
      reject in interface ImmutableLongSet
      Specified by:
      reject in interface LongIterable
      Specified by:
      reject in interface LongSet
    • collect

      public <V> ImmutableSet<V> collect(LongToObjectFunction<? extends V> function)
      Description copied from interface: LongIterable
      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 ImmutableLongCollection
      Specified by:
      collect in interface ImmutableLongSet
      Specified by:
      collect in interface LongIterable
      Specified by:
      collect in interface LongSet
    • detectIfNone

      public long detectIfNone(LongPredicate predicate, long ifNone)
      Specified by:
      detectIfNone in interface LongIterable
    • count

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

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

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

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

      public long sum()
      Specified by:
      sum in interface LongIterable
    • max

      public long max()
      Specified by:
      max in interface LongIterable
    • min

      public long min()
      Specified by:
      min in interface LongIterable
    • injectInto

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

      private Object writeReplace()
    • probe

      int probe(long element)
    • probeTwo

      int probeTwo(long element, int removedIndex)
    • probeThree

      int probeThree(long element, int removedIndex)
    • spreadAndMask

      int spreadAndMask(long element)
    • spreadTwoAndMask

      int spreadTwoAndMask(long element)
    • mask

      private int mask(int spread)