Class LongHashSet

  • All Implemented Interfaces:
    Accountable

    final class LongHashSet
    extends java.lang.Object
    implements Accountable
    Set of longs, optimized for docvalues usage
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long BASE_RAM_BYTES  
      (package private) boolean hasMissingValue  
      (package private) int mask  
      (package private) long maxValue
      maximum value in the set, or Long.MIN_VALUE for an empty set
      (package private) long minValue
      minimum value in the set, or Long.MAX_VALUE for an empty set
      private static long MISSING  
      (package private) int size  
      (package private) long[] table  
    • Constructor Summary

      Constructors 
      Constructor Description
      LongHashSet​(long[] values)
      Construct a set.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean add​(long l)  
      (package private) boolean contains​(long l)
      check for membership in the set.
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      long ramBytesUsed()
      Return the memory usage of this object in bytes.
      (package private) int size()
      number of elements in the set
      (package private) java.util.stream.LongStream stream()
      returns a stream of all values contained in this set
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BASE_RAM_BYTES

        private static final long BASE_RAM_BYTES
      • table

        final long[] table
      • mask

        final int mask
      • hasMissingValue

        final boolean hasMissingValue
      • size

        final int size
      • minValue

        final long minValue
        minimum value in the set, or Long.MAX_VALUE for an empty set
      • maxValue

        final long maxValue
        maximum value in the set, or Long.MIN_VALUE for an empty set
    • Constructor Detail

      • LongHashSet

        LongHashSet​(long[] values)
        Construct a set. Values must be in sorted order.
    • Method Detail

      • add

        private boolean add​(long l)
      • contains

        boolean contains​(long l)
        check for membership in the set.

        You should use minValue and maxValue to guide/terminate iteration before calling this.

      • stream

        java.util.stream.LongStream stream()
        returns a stream of all values contained in this set
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • size

        int size()
        number of elements in the set
      • ramBytesUsed

        public long ramBytesUsed()
        Description copied from interface: Accountable
        Return the memory usage of this object in bytes. Negative values are illegal.
        Specified by:
        ramBytesUsed in interface Accountable