class · System
Dictionary<K, V>
public class System.Dictionary<K, V> : System.Any
- Kind
- class
- Namespace
- System
- Assembly
- System.Core
- Access
- public
- Source file
Dictionary.ant
Type parameters
| Name | Constraints |
|---|---|
K | System.IHashable<K> |
V | any type |
Inheritance
- Base classes
-
AnyDictionary<K, V>
Constructors
constructor Dictionary()
#
Properties
Methods
method Set(key: K, value: V) -> void
#
Gives key the value value (adding it, or replacing its value).
method Get(key: K) -> V
#
The value of key; a KeyNotFoundError when there is none.
method At(key: K) -> V
#
map[key].
method SetAt(key: K, value: V) -> void
#
map[key] = value.
method TryGet(key: K, fallback: V) -> V
#
The value of key, or fallback when there is none.
Takes key out; false when it was not there.
method Clear() -> void
#
method Keys() -> System.List<K>
#
The keys, in the table's order.
method Iterator() -> System.DictionaryIterator<K, V>
#
loop (KeyValuePair<K, V> pair in map), in the table's order.
The slots (for the iterator).
Private and internal members (12)
field keys: K[]
#
field values: V[]
#
Per slot: 0 empty, 2 removed (probing goes on past it), else (odd) the top bits of the key's mixed hash: probing compares them before it looks at a key, and resizing places pairs without hashing their keys again.
The table has 2^bits slots.
A key's tag: the top 32 bits of its hash × 2^64/φ (Fibonacci hashing), made odd.
The first slot to look at for a tag (its top bits).
The slot holding key, or -1.
A slot for a new pair with this tag (empty or removed).
Rebuilds the table with 2^newBits slots.
Adds a pair whose key is not in the table.
Inherited members (5)
GetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
Dictionary<K, V> as Larva HIR, decompiled from its Larva HIR.
public class System.Dictionary<K, V> : System.Any
{
field keys: K[]
field values: V[]
// Per slot: 0 empty, 2 removed (probing goes on past it), else (odd) the top bits of the key's mixed hash: probing
// compares them before it looks at a key, and resizing places pairs without hashing their keys again.
field tags: u32[]
field count: i32
field used: i32
// The table has 2^bits slots.
field bits: i32
// A key's tag: the top 32 bits of its hash × 2^64/φ (Fibonacci hashing), made odd.
static method Tag(hash: u64) -> u32
// The first slot to look at for a tag (its top bits).
method Home(tag: u32) -> i32
// The slot holding `key`, or -1.
method Find(key: K) -> i32
// A slot for a new pair with this tag (empty or removed).
method Free(tag: u32) -> i32
// Rebuilds the table with 2^newBits slots.
method Resize(newBits: i32) -> void
// Adds a pair whose key is not in the table.
method Add(key: K, value: V, tag: u32) -> void
constructor Dictionary()
// Gives `key` the value `value` (adding it, or replacing its value).
method Set(key: K, value: V) -> void
// The value of `key`; a KeyNotFoundError when there is none.
method Get(key: K) -> V
// `map[key]`.
method At(key: K) -> V
// `map[key] = value`.
method SetAt(key: K, value: V) -> void
// The value of `key`, or `fallback` when there is none.
method TryGet(key: K, fallback: V) -> V
method ContainsKey(key: K) -> bool
// Takes `key` out; false when it was not there.
method Remove(key: K) -> bool
method Clear() -> void
// The keys, in the table's order.
method Keys() -> System.List<K>
// `loop (KeyValuePair<K, V> pair in map)`, in the table's order.
method Iterator() -> System.DictionaryIterator<K, V>
// The slots (for the iterator).
method Holds(slot: i32) -> bool
method KeyAt(slot: i32) -> K
method ValueAt(slot: i32) -> V
property Count: i32
property IsEmpty: bool
property Slots: i32
}