MapExtensions<K, V> extension

Extensions on Map for lookup and transformation.

on

Methods

deepMerge(Map<K, V> other) Map<K, V>

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

Recursively merges two maps.
filterKeys(bool test(K key)) Map<K, V>

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

Keeps entries whose key matches test.
filterValues(bool test(V value)) Map<K, V>

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

Keeps entries whose value matches test.
getOrElse(K key, V defaultValue) → V

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

Gets a value from a map, or a default value if the key doesn't exist.
getOrPut(K key, V put()) → V

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

Returns the value for key, computing and storing it if absent.
invert() Map<V, K>

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

Swaps keys and values.
keysOf(V value) List<K>

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

Keys whose value equals value.
mapKeys<T>(T transform(K key)) Map<T, V>

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

Transforms the keys of a map.
mapValues<T>(T transform(V value)) Map<K, T>

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

Transforms the values of a map.
merge(Map<K, V> other) Map<K, V>

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

Shallow merge with other (other wins on key conflicts).
omit(Iterable<K> keys) Map<K, V>

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

Returns a new map without the given keys.
pick(Iterable<K> keys) Map<K, V>

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

Returns a new map with only the given keys (missing keys ignored).
where(bool test(K key, V value)) Map<K, V>

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

Filters a map based on a predicate.