Class LongHashSet

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

    public class LongHashSet
    extends java.lang.Object
    implements java.util.Set<java.lang.Long>
    Special Set instance that hashes the Set<Long> column IDs with excellent dispersion, while at the same time, using only a single primitive long (8 bytes) per entry. This set is backed by a long[], so adding and removing items is O(n).
    • Constructor Summary

      Constructors 
      Constructor Description
      LongHashSet()  
      LongHashSet​(java.util.Set col)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(int n)  
      boolean add​(java.lang.Long n)  
      boolean addAll​(java.util.Collection col)  
      void clear()  
      boolean contains​(java.lang.Object item)  
      boolean containsAll​(java.util.Collection col)  
      boolean equals​(java.lang.Object other)  
      int hashCode()  
      boolean isEmpty()  
      java.util.Iterator iterator()  
      boolean remove​(java.lang.Object n)  
      boolean removeAll​(java.util.Collection col)  
      boolean retainAll​(java.util.Collection col)  
      int size()  
      java.lang.Object[] toArray()  
      java.lang.Object[] toArray​(java.lang.Object[] a)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, 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

        spliterator
    • Constructor Detail

      • LongHashSet

        public LongHashSet()
      • LongHashSet

        public LongHashSet​(java.util.Set col)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.Long>
        Specified by:
        size in interface java.util.Set<java.lang.Long>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<java.lang.Long>
        Specified by:
        isEmpty in interface java.util.Set<java.lang.Long>
      • contains

        public boolean contains​(java.lang.Object item)
        Specified by:
        contains in interface java.util.Collection<java.lang.Long>
        Specified by:
        contains in interface java.util.Set<java.lang.Long>
      • iterator

        public java.util.Iterator iterator()
        Specified by:
        iterator in interface java.util.Collection<java.lang.Long>
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Long>
        Specified by:
        iterator in interface java.util.Set<java.lang.Long>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<java.lang.Long>
        Specified by:
        toArray in interface java.util.Set<java.lang.Long>
      • add

        public boolean add​(int n)
      • add

        public boolean add​(java.lang.Long n)
        Specified by:
        add in interface java.util.Collection<java.lang.Long>
        Specified by:
        add in interface java.util.Set<java.lang.Long>
      • remove

        public boolean remove​(java.lang.Object n)
        Specified by:
        remove in interface java.util.Collection<java.lang.Long>
        Specified by:
        remove in interface java.util.Set<java.lang.Long>
      • addAll

        public boolean addAll​(java.util.Collection col)
        Specified by:
        addAll in interface java.util.Collection<java.lang.Long>
        Specified by:
        addAll in interface java.util.Set<java.lang.Long>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<java.lang.Long>
        Specified by:
        clear in interface java.util.Set<java.lang.Long>
      • removeAll

        public boolean removeAll​(java.util.Collection col)
        Specified by:
        removeAll in interface java.util.Collection<java.lang.Long>
        Specified by:
        removeAll in interface java.util.Set<java.lang.Long>
      • retainAll

        public boolean retainAll​(java.util.Collection col)
        Specified by:
        retainAll in interface java.util.Collection<java.lang.Long>
        Specified by:
        retainAll in interface java.util.Set<java.lang.Long>
      • containsAll

        public boolean containsAll​(java.util.Collection col)
        Specified by:
        containsAll in interface java.util.Collection<java.lang.Long>
        Specified by:
        containsAll in interface java.util.Set<java.lang.Long>
      • toArray

        public java.lang.Object[] toArray​(java.lang.Object[] a)
        Specified by:
        toArray in interface java.util.Collection<java.lang.Long>
        Specified by:
        toArray in interface java.util.Set<java.lang.Long>
      • equals

        public boolean equals​(java.lang.Object other)
        Specified by:
        equals in interface java.util.Collection<java.lang.Long>
        Specified by:
        equals in interface java.util.Set<java.lang.Long>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<java.lang.Long>
        Specified by:
        hashCode in interface java.util.Set<java.lang.Long>
        Overrides:
        hashCode in class java.lang.Object