PerfectHashing

dotty.tools.dotc.util.PerfectHashing
See thePerfectHashing companion object
class PerfectHashing[Key](initialCapacity: Int, capacityMultiple: Int)

A map that maps keys to unique integers in a dense interval starting at 0.

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 Object
trait Matchable
class Any
Known subtypes
class IntMap[Key]

Members list

Value members

Concrete methods

def add(k: Key): Int

An index idx such that key(idx) == k. If no such index exists, create an entry with an index one larger than the previous one.

An index idx such that key(idx) == k. If no such index exists, create an entry with an index one larger than the previous one.

Attributes

final def capacity: Int

The number of keys that can be stored without growing the tables

The number of keys that can be stored without growing the tables

Attributes

def clear(): Unit

Remove keys from this map and set back to initial configuration

Remove keys from this map and set back to initial configuration

Attributes

def index(k: Key): Int

An index idx such that key(idx) == k, or -1 if no such index exists

An index idx such that key(idx) == k, or -1 if no such index exists

Attributes

def key(idx: Int): Key

The key at index idx

The key at index idx

Attributes

final def size: Int

The number of keys

The number of keys

Attributes