struct OrderedMap(K, V)

A simple data structure based on the built-in associative array, but with a fixed element order.

V[K] map

Underlying associative array for key-value storage.

K[] keys

Array of keys preserving insertion order.

OrderedMap dup() const

This method returns a copy of the map.

void put(K key, V value)

Inserts a key-value pair into the map.

const(V) get(K key) const

Returns the value associated with the given key.

const(V) get(K key, const(V) defaultValue) const

Safely returns the value associated with the given key. If the key does not exist, returns defaultValue.

void remove(K key)

Removes an element by the specified key. Does nothing if the key is not present.

V[] values()

Returns array of values.

size_t length() nothrow const

Returns the number of elements in the map.

string toString() const

Returns a string representation.