IntMap

dotty.tools.dotc.util.IntMap
final class IntMap[Key](initialCapacity: Int, capacityMultiple: Int) extends PerfectHashing[Key]

A dense map from some Key type to Int. Dense means: All keys and values are stored in arrays from 0 up to the size of the map. Keys and values can be obtained by index usingkey(index)andvalue(index). Values can also be stored usingsetValue(index, value)`.

ome 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

Graph
Supertypes
class PerfectHashing[Key]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def apply(k: Key): Int

The value associated with key k, or else default.

The value associated with key k, or else default.

Attributes

def default: Int
def iterator: Iterator[(Key, Int)]
def setValue(i: Int, v: Int): Unit

Change the value stored at index i to v

Change the value stored at index i to v

Attributes

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
Any
def update(k: Key, v: Int): Unit

Associate key k with value v

Associate key k with value v

Attributes

def value(i: Int): Int

The value stored at index i

The value stored at index i

Attributes

Inherited 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

Inherited from:
PerfectHashing
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

Inherited from:
PerfectHashing
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

Inherited from:
PerfectHashing
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

Inherited from:
PerfectHashing
def key(idx: Int): Key

The key at index idx

The key at index idx

Attributes

Inherited from:
PerfectHashing

Attributes

Inherited from:
PerfectHashing
final def size: Int

The number of keys

The number of keys

Attributes

Inherited from:
PerfectHashing