Skip to main content

Class: Dictionary<K, V>

A type that represents a dictionary of keys to values. Similar to a Map in JavaScript.

Type Parameters​

Type ParameterDescription

K

The type of the keys in the dictionary.

V

The type of the values in the dictionary.

Implements​

Constructors​

new Dictionary()​

new Dictionary<K, V>(keySchema: Schema<K>, valueSchema: Schema<V>, sizeSchema: Schema<number>): Dictionary<K, V>

Creates a new dictionary type.

Parameters​

ParameterTypeDescription

keySchema

Schema<K>

The schema for the keys in the dictionary.

valueSchema

Schema<V>

The schema for the values in the dictionary.

sizeSchema

Schema<number>

The schema for the size of the dictionary.

Returns​

Dictionary<K, V>

Defined in​

types/dictionary.ts:20

Methods​

read()​

read(reader: ByteStreamReader): Map<K, V>

Parameters​

ParameterType

reader

ByteStreamReader

Returns​

Map<K, V>

Implementation of​

Schema.read

Defined in​

types/dictionary.ts:26


write()​

write(writer: ByteStreamWriter, value: Map<K, V>): void

Parameters​

ParameterType

writer

ByteStreamWriter

value

Map<K, V>

Returns​

void

Implementation of​

Schema.write

Defined in​

types/dictionary.ts:37