Class CharHashSet.ImmutableCharHashSet

All Implemented Interfaces:
Serializable, CharIterable, ImmutableCharCollection, PrimitiveIterable, CharSet, ImmutableCharSet
Enclosing class:
CharHashSet

private static final class CharHashSet.ImmutableCharHashSet extends AbstractImmutableCharSet implements Serializable
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • table

      private final char[] table
    • occupied

      private final int occupied
    • zeroToThirtyOne

      private final int zeroToThirtyOne
    • zeroToThirtyOneOccupied

      private final int zeroToThirtyOneOccupied
  • Constructor Details

    • ImmutableCharHashSet

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

    • checkOptimizedSize

      private void checkOptimizedSize(int length)
    • newSetWith

      public static ImmutableCharSet newSetWith(char... elements)
    • hashCode

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

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

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

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

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

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

      public ImmutableCharSet select(CharPredicate predicate)
      Description copied from interface: CharIterable
      Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.
      Specified by:
      select in interface CharIterable
      Specified by:
      select in interface CharSet
      Specified by:
      select in interface ImmutableCharCollection
      Specified by:
      select in interface ImmutableCharSet
    • reject

      public ImmutableCharSet reject(CharPredicate predicate)
      Description copied from interface: CharIterable
      Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.
      Specified by:
      reject in interface CharIterable
      Specified by:
      reject in interface CharSet
      Specified by:
      reject in interface ImmutableCharCollection
      Specified by:
      reject in interface ImmutableCharSet
    • collect

      public <V> ImmutableSet<V> collect(CharToObjectFunction<? extends V> function)
      Description copied from interface: CharIterable
      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 CharIterable
      Specified by:
      collect in interface CharSet
      Specified by:
      collect in interface ImmutableCharCollection
      Specified by:
      collect in interface ImmutableCharSet
    • detectIfNone

      public char detectIfNone(CharPredicate predicate, char ifNone)
      Specified by:
      detectIfNone in interface CharIterable
    • count

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

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

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

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

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

      public char max()
      Specified by:
      max in interface CharIterable
    • min

      public char min()
      Specified by:
      min in interface CharIterable
    • injectInto

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

      private Object writeReplace()
    • probe

      int probe(char element)
    • probeTwo

      int probeTwo(char element, int removedIndex)
    • probeThree

      int probeThree(char element, int removedIndex)
    • spreadAndMask

      int spreadAndMask(char element)
    • spreadTwoAndMask

      int spreadTwoAndMask(char element)
    • mask

      private int mask(int spread)