Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions common/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ export class TypedMap<K, V> {
return null
}

mustGetEntry(key: K): TypedMapEntry<K, V> {
const entry = this.getEntry(key)
assert(entry != null, `Entry for key ${key} does not exist in TypedMap`)
return entry!
}

get(key: K): V | null {
for (let i: i32 = 0; i < this.entries.length; i++) {
if (this.entries[i].key == key) {
Expand All @@ -327,6 +333,12 @@ export class TypedMap<K, V> {
return null
}

mustGet(key: K): V {
const value = this.get(key)
assert(value != null, `Value for key ${key} does not exist in TypedMap`)
return value!
}

isSet(key: K): bool {
for (let i: i32 = 0; i < this.entries.length; i++) {
if (this.entries[i].key == key) {
Expand Down