HashSet

dotty.tools.dotc.util.HashSet
See theHashSet companion object
class HashSet[T](initialCapacity: Int, capacityMultiple: Int) extends GenericHashSet[T]

A hash set that allows some privileged protected access to its internals

Value parameters

capacityMultiple

The minimum multiple of capacity relative to used elements. The hash table will be re-sized once the number of elements multiplied by capacityMultiple exceeds the current size of the hash table. However, a table of size up to DenseLimit will be re-sized only once the number of elements reaches the table's size.

initialCapacity

Indicates the initial number of slots in the hash table. The actual number of slots is always a power of 2, so the initial size of the table will be the smallest power of two that is equal or greater than the given initialCapacity. Minimum value is 4.

Attributes

Companion
object
Graph
Supertypes
class GenericHashSet[T]
class MutableSet[T]
class ReadOnlySet[T]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited and Abstract classlikes

abstract class EntryIterator extends Iterator[T]

Attributes

Inherited from:
GenericHashSet
Supertypes
trait Iterator[T]
trait IterableOnce[T]
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

override def +=(x: T): Unit

Add element x to the set

Add element x to the set

Attributes

Definition Classes
override def add(x: T): Boolean

attempts to put x in the Set, if it was not entered before, return true, else return false.

attempts to put x in the Set, if it was not entered before, return true, else return false.

Attributes

Definition Classes
override def copyFrom(oldTable: Array[AnyRef | Null]): Unit

Attributes

Definition Classes
override def lookup(x: T): T | Null

The entry in the set such that isEqual(x, entry), or else null.

The entry in the set such that isEqual(x, entry), or else null.

Attributes

Definition Classes
override def put(x: T): T

Like += but return existing element equal to x of it exists, x itself otherwise.

Like += but return existing element equal to x of it exists, x itself otherwise.

Attributes

Definition Classes

Inherited methods

def ++=(xs: IterableOnce[T]): Unit

Attributes

Inherited from:
MutableSet
def --=(xs: IterableOnce[T]): Unit

Attributes

Inherited from:
MutableSet
def -=(x: T): Unit

Remove element x from the set

Remove element x from the set

Attributes

Inherited from:
GenericHashSet
def clear(resetToInitial: Boolean): Unit

Remove all elements from this set.

Remove all elements from this set.

Value parameters

resetToInitial

If true, set back to initial configuration, which includes reallocating tables.

Attributes

Inherited from:
GenericHashSet
def contains(x: T): Boolean

Attributes

Inherited from:
ReadOnlySet
def foreach[U](f: T => U): Unit

Attributes

Inherited from:
ReadOnlySet

Attributes

Inherited from:
ReadOnlySet
def iterator: Iterator[T]

Attributes

Inherited from:
GenericHashSet
def remove(x: T): Boolean

Attributes

Inherited from:
GenericHashSet
def size: Int

The number of elements in the set

The number of elements in the set

Attributes

Inherited from:
GenericHashSet
def toList: List[T]

Attributes

Inherited from:
ReadOnlySet
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Inherited from:
GenericHashSet