getOrElse

inline fun <Key, Value> GdxMap<Key, Value>.getOrElse(key: Key, defaultValue: () -> Value): Value

Returns the value for the given key. If the key is not found in the map, returns the result of the defaultValue function without storing it in the map. Unlike GdxMap.get with a default value, defaultValue is only invoked when necessary.

Throws an IllegalArgumentException when key is null.


inline fun <Value> IntMap<Value>.getOrElse(key: Int, defaultValue: () -> Value): Value
inline fun <Value> LongMap<Value>.getOrElse(key: Long, defaultValue: () -> Value): Value

Returns the value for the given key. If the key is not found in the map, returns the result of the defaultValue function without storing it in the map.