Import std.collections.immutable
ImmutableMap
struct
@DebugEntries Public Struct ImmutableMap<K, V> Implements Iterable<(K, V)>, Defaultable, Sendable
A Map that never changes: each change gives a new one, which shares what it can with the old, so threads can share it.
Examples
Local empty = ImmutableMap<String, Int>()
Local ages = empty.Add("Ada", 36).Add("Alan", 41)
Expect(empty.Count == 0 && ages.Count == 2)
Expect(ages.Get("Ada") == 36)
Expect(!ages.Remove("Ada").Contains("Ada") && ages.Contains("Ada"))std/collections/immutable.fb, line 372
-
An empty one.
-
One with the
entries, all read first, a second entry's value for a key taking the place of an earlier one's. -
How many entries it holds.
-
The
key's value, or Null when it isn't there. -
The
key's value, orfallbackwhen it isn't there. -
The key's value. A key that isn't there panics.
-
Whether
keyhas an entry. -
A copy with the
key'svalue, which takes the place of the one it has. -
A copy with each of the
entriesadded in turn, as Add adds one, all read first. -
A copy without the
key's entry, or the same one when it has none. -
The keys, in the order the entries go in.
-
The values, in their keys' order.
-
A new Map with the same entries, in the same order.
-
An empty one.
-
Each key and its value, for 'For key, value In map', by their keys' hashes, and keys of one hash in the order they were added.
Report an issue with this page or with FutureBlitz on GitHub.