Class

org.apache.spark.util.collection

OpenHashSet

Related Doc: package collection

Permalink

class OpenHashSet[T] extends Serializable

A simple, fast hash set optimized for non-null insertion-only use case, where keys are never removed.

The underlying implementation uses Scala compiler's specialization to generate optimized storage for two primitive types (Long and Int). It is much faster than Java's standard HashSet while incurring much less memory overhead. This can serve as building blocks for higher level data structures such as an optimized HashMap.

This OpenHashSet is designed to serve as building blocks for higher level data structures such as an optimized hash map. Compared with standard hash set implementations, this class provides its various callbacks interfaces (e.g. allocateFunc, moveFunc) and interfaces to retrieve the position of a key in the underlying array.

It uses quadratic probing with a power-of-2 hash table size, which is guaranteed to explore all spaces for each key (see http://en.wikipedia.org/wiki/Quadratic_probing).

Annotations
@Private()
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OpenHashSet
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OpenHashSet()(implicit arg0: ClassTag[T])

    Permalink
  2. new OpenHashSet(initialCapacity: Int)(implicit arg0: ClassTag[T])

    Permalink
  3. new OpenHashSet(initialCapacity: Int, loadFactor: Double)(implicit arg0: ClassTag[T])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. var _bitset: BitSet

    Permalink
    Attributes
    protected
  5. var _capacity: Int

    Permalink
    Attributes
    protected
  6. var _data: Array[T]

    Permalink
    Attributes
    protected
  7. var _growThreshold: Int

    Permalink
    Attributes
    protected
  8. var _mask: Int

    Permalink
    Attributes
    protected
  9. var _size: Int

    Permalink
    Attributes
    protected
  10. def add(k: T): Unit

    Permalink

    Add an element to the set.

    Add an element to the set. If the set is over capacity after the insertion, grow the set and rehash all elements.

  11. def addWithoutResize(k: T): Int

    Permalink

    Add an element to the set.

    Add an element to the set. This one differs from add in that it doesn't trigger rehashing. The caller is responsible for calling rehashIfNeeded.

    Use (retval & POSITION_MASK) to get the actual position, and (retval & NONEXISTENCE_MASK) == 0 for prior existence.

    returns

    The position where the key is placed, plus the highest order bit is set if the key does not exists previously.

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def capacity: Int

    Permalink

    The capacity of the set (i.e.

    The capacity of the set (i.e. size of the underlying array).

  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def contains(k: T): Boolean

    Permalink

    Return true if this set contains the specified element.

  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def getBitSet: BitSet

    Permalink
  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. def getPos(k: T): Int

    Permalink

    Return the position of the element in the underlying array, or INVALID_POS if it is not found.

  22. def getValue(pos: Int): T

    Permalink

    Return the value at the specified position.

  23. def getValueSafe(pos: Int): T

    Permalink

    Return the value at the specified position.

  24. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  25. val hasher: Hasher[T]

    Permalink
    Attributes
    protected
  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. def iterator: Iterator[T]

    Permalink
  28. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. def nextPos(fromPos: Int): Int

    Permalink

    Return the next position with an element stored, starting from the given position inclusively.

  30. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. def rehashIfNeeded(k: T, allocateFunc: (Int) ⇒ Unit, moveFunc: (Int, Int) ⇒ Unit): Unit

    Permalink

    Rehash the set if it is overloaded.

    Rehash the set if it is overloaded.

    k

    A parameter unused in the function, but to force the Scala compiler to specialize this method.

    allocateFunc

    Callback invoked when we are allocating a new, larger array.

    moveFunc

    Callback invoked when we move the key from one position (in the old data array) to a new position (in the new data array).

  33. def size: Int

    Permalink

    Number of elements in the set.

  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  35. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  36. def union(other: OpenHashSet[T]): OpenHashSet[T]

    Permalink
  37. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped