WordWordMap

Members

Functions

get
string[] get(string key)

Return the values given the key. Empty array will be returned if the key doesn't exist in the key set.

Properties

byKey
IterableKeys byKey [@property getter]

Returns a forward range which will iterate over the keys of the dictionary.

Examples

string to string

1 auto dictionary = new WordWordMap(["Win", "hot"], ["Lose", "cold"]);
2 
3 assert(dictionary.get("Win") == ["Lose"]);
4 assert(dictionary.get("hot") == ["cold"]);
5 
6 bool error_thrown = false;
7 try {
8     dictionary.get("won");
9 } catch(KeyError e) {
10     error_thrown = true;
11 }
12 assert(error_thrown);

Meta