Class OpenHashSet<T>

  • Type Parameters:
    T - the element type

    public final class OpenHashSet<T>
    extends java.lang.Object
    A simple open hash set with add, remove and clear capabilities only.

    Doesn't support nor checks for nulls.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int INT_PHI  
      (package private) T[] keys  
      (package private) float loadFactor  
      (package private) int mask  
      (package private) int maxSize  
      (package private) int size  
    • Constructor Summary

      Constructors 
      Constructor Description
      OpenHashSet()  
      OpenHashSet​(int capacity)
      Creates an OpenHashSet with the initial capacity and load factor of 0.75f.
      OpenHashSet​(int capacity, float loadFactor)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(T value)  
      java.lang.Object[] keys()  
      (package private) static int mix​(int x)  
      (package private) void rehash()  
      boolean remove​(T value)  
      (package private) boolean removeEntry​(int pos, T[] a, int m)  
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • loadFactor

        final float loadFactor
      • mask

        int mask
      • size

        int size
      • maxSize

        int maxSize
      • keys

        T[] keys
    • Constructor Detail

      • OpenHashSet

        public OpenHashSet()
      • OpenHashSet

        public OpenHashSet​(int capacity)
        Creates an OpenHashSet with the initial capacity and load factor of 0.75f.
        Parameters:
        capacity - the initial capacity
      • OpenHashSet

        public OpenHashSet​(int capacity,
                           float loadFactor)
    • Method Detail

      • add

        public boolean add​(T value)
      • remove

        public boolean remove​(T value)
      • removeEntry

        boolean removeEntry​(int pos,
                            T[] a,
                            int m)
      • rehash

        void rehash()
      • mix

        static int mix​(int x)
      • keys

        public java.lang.Object[] keys()
      • size

        public int size()