Class IdentityOpenHashSet<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

    public class IdentityOpenHashSet<E>
    extends java.util.AbstractSet<E>
    • Constructor Summary

      Constructors 
      Constructor Description
      IdentityOpenHashSet​(int capacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(E newVal)  
      private void addForResize​(E[] buffer, int mask, E newVal)  
      private boolean addSlowPath​(E[] buffer, int mask, E newVal, int hash)  
      private void compactAndRemove​(E[] buffer, int mask, int removeHashIndex)  
      boolean contains​(java.lang.Object needle)  
      private boolean containsSlowPath​(E[] buffer, int mask, int hash, java.lang.Object needle)  
      java.util.Iterator<E> iterator()  
      boolean remove​(java.lang.Object val)  
      private boolean removeSlowPath​(java.lang.Object val, E[] buffer, int mask, int hash)  
      private void resize()  
      int size()  
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

        addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        addAll, clear, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
    • Field Detail

      • size

        private int size
      • buffer

        private E[] buffer
      • resizeThreshold

        private int resizeThreshold
    • Constructor Detail

      • IdentityOpenHashSet

        public IdentityOpenHashSet​(int capacity)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in interface java.util.Set<E>
        Specified by:
        size in class java.util.AbstractCollection<E>
      • add

        public boolean add​(E newVal)
        Specified by:
        add in interface java.util.Collection<E>
        Specified by:
        add in interface java.util.Set<E>
        Overrides:
        add in class java.util.AbstractCollection<E>
      • addForResize

        private void addForResize​(E[] buffer,
                                  int mask,
                                  E newVal)
      • addSlowPath

        private boolean addSlowPath​(E[] buffer,
                                    int mask,
                                    E newVal,
                                    int hash)
      • resize

        private void resize()
      • remove

        public boolean remove​(java.lang.Object val)
        Specified by:
        remove in interface java.util.Collection<E>
        Specified by:
        remove in interface java.util.Set<E>
        Overrides:
        remove in class java.util.AbstractCollection<E>
      • removeSlowPath

        private boolean removeSlowPath​(java.lang.Object val,
                                       E[] buffer,
                                       int mask,
                                       int hash)
      • compactAndRemove

        private void compactAndRemove​(E[] buffer,
                                      int mask,
                                      int removeHashIndex)
      • contains

        public boolean contains​(java.lang.Object needle)
        Specified by:
        contains in interface java.util.Collection<E>
        Specified by:
        contains in interface java.util.Set<E>
        Overrides:
        contains in class java.util.AbstractCollection<E>
      • containsSlowPath

        private boolean containsSlowPath​(E[] buffer,
                                         int mask,
                                         int hash,
                                         java.lang.Object needle)
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Specified by:
        iterator in interface java.util.Set<E>
        Specified by:
        iterator in class java.util.AbstractCollection<E>