GetOrPut<K, V> extension

on
  • Map<K, V>

Methods

getOrPut(K key, V defaultValue(K value)) → V

Available on Map<K, V>, provided by the GetOrPut extension

Returns the value for the given key. If the key is not found in the map, calls the defaultValue function, puts its result into the map under the given key and returns it.