MapExtensions<K, V> extension

on

Properties

invert Map<V, K>

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

Swaps keys and values (values must be unique)
no setter
toJson String

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

Returns a parsed json string of this map.
no setter
toQueryString String

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

Converts the map into a URL query-string style representation (e.g. ?key1=value1&key2=value2)
no setter

Methods

containsAllKeys(List<K> keys) bool

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

Checks if it contains all required keys.
containsAnyKey(List<K> keys) bool

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

Checks if it contains any key from a list.
ensureKey(K key, V value) → void

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

Ensure that the map contains the key. If not, add it with the value to prevent null or overriding values.
excludeKeys(List<K> keys) Map<K, V>

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

Returns a new map containing entries whose keys are not in the keys list.
excludeValues(List<V> values) Map<K, V>

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

Returns a new map containing entries whose values are not in the values list.
filterKeys(bool test(K key)) Map<K, V>

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

Returns a new map containing only entries whose keys satisfy a predicate.
filterValues(bool test(V value)) Map<K, V>

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

Returns a new map containing only entries whose values satisfy a predicate.
mapKeys<K2>(K2 transform(K key)) Map<K2, V>

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

Transforms all the keys in the map by applying a transform function.
mapValues<V2>(V2 transform(V value)) Map<K, V2>

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

Transforms all the values in the map by applying a transform function.
mergeWith(Map<K, V> other, V combine(V value1, V value2)) Map<K, V>

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

Merges two maps, using a custom combine function when keys overlap.
pickKeys(List<K> keys) Map<K, V>

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

Returns a new map containing entries whose keys are in the keys list.
pickValues(List<V> values) Map<K, V>

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

Returns a new map containing entries whose values are in the values list.
safeUpdate(K key, V value) → void

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

Updates only if the key already exists. Else, do nothing.