klyn.collections.HashMap.get
method
public get<R>(key as K, defaultValue as R) as R:
Description

Returns the associated value or a typed default when the key is absent.

The generic return type R is inferred from defaultValue. An existing value is cast to R, preserving static typing for heterogeneous maps.

Parameters
ParameterDescription
keyThe key to search for.
defaultValueThe value returned for an absent key.
Returns

The stored value cast to R, or defaultValue.

Example
config = HashMap<String, Object>()
config["theme"] = "dark"
theme = config.get("theme", "light")
assert theme == "dark"