getOrPut

fun getOrPut(key: K, mappingFunction: (K) -> V): V

Answer the value at the provided key. If no value is available (null is at Enum.ordinal in the sourceValues array), evaluate the lambda, place the resulting value in this map at that key, then answer the value.

Return

The stored value or the result of the mappingFunction.

Parameters

key

The key to look up.

mappingFunction

The function to run to produce a value if none found.