The OpenD Programming Language

StringMap.get

Looks up key; if it exists returns corresponding value else evaluates and returns defaultValue.

Complexity: O(log(s)), where s is the number of the keys with the same length as the input key.

struct StringMap(T)
inout
inout(T)
get
()
(
scope const(char)[] key
,
lazy inout(T) defaultValue
)

Examples

StringMap!int map;
map["c"] = 3;
assert(map.get("c", 1) == 3);
assert(map.get("C", 1) == 1);

Meta