MapUtils extension
Properties
isEmpty
→ bool
Returns true
if the map is empty, false
otherwise.
no setter
Methods
camelCaseKeys <V > ()
→ Map <String , V >
Camel case all keys in the map.
Returns a new map with camel cased keys.
camelCaseValues <K > ()
→ Map <K , String >
Camel case all values in the map.
Returns a new map with camel cased values.
capitalizeKeys <V > ()
→ Map <String , V >
Capitalize all keys in the map.
Returns a new map with capitalized keys.
capitalizeValues <K > ()
→ Map <K , String >
Capitalize all values in the map.
Returns a new map with capitalized values.
contains (Object key , Object value )
→ bool
Returns true
if the map contains the specified key
and value
, false
otherwise.
filter <K , V > (bool predicate (K key , V value ) )
→ Map <K , V >
Returns a new map with all entries that satisfy the given predicate
.
The entries in the resulting map preserve the order of the original map.
filterEmpty <K , V > ()
→ Map <K , V >
Filter empty values from the map.
Returns a new map with non-empty values.
filterKeys <K , V > (Iterable <K > keys )
→ Map <K , V >
Filter where the key is in the given keys
.
Returns a new map with filtered entries.
filterNot <K , V > (bool predicate (K key , V value ) )
→ Map <K , V >
Returns a new map with all entries that satisfy the given predicate
.
The entries in the resulting map do not preserve the order of the original map.
filterNull <K , V > ()
→ Map <K , V >
Filter null values from the map.
Returns a new map with non-null values.
filterValues <K , V > (Iterable <V > values )
→ Map <K , V >
Filter where the value is in the given values
.
Returns a new map with filtered entries.
kebabCaseKeys <V > ()
→ Map <String , V >
Kebab case all keys in the map.
Returns a new map with kebab cased keys.
kebabCaseValues <K > ()
→ Map <K , String >
Kebab case all values in the map.
Returns a new map with kebab cased values.
partition <K , V > (bool predicate (K key , V value ) )
→ Pair <Map <K , V > , Map <K , V > >
Split map into two maps based on the predicate
.
Returns a list of two maps.
prefixKeys <V > (String prefix )
→ Map <String , V >
Add prefix to all keys in the map.
Returns a new map with prefixed keys.
prefixValues <K > (String prefix )
→ Map <K , String >
Add prefix to all values in the map.
Returns a new map with prefixed values.
printDebug <K , V > ({String label = 'Map' , String separator = ': ' , String indent = ' ' })
→ void
debug print the map with label
and separator
.
label
is the label for the map.
separator
is the separator between key and value.
indent
is the indent for each line.
reject <K , V > (bool predicate (K key , V value ) )
→ Map <K , V >
Returns a new map with all entries that do not satisfy the given predicate
.
The entries in the resulting map preserve the order of the original map.
rejectKeys <K , V > (Iterable <K > keys )
→ Map <K , V >
Filter where the key is not in the given keys
.
Returns a new map with filtered entries.
rejectNot <K , V > (bool predicate (K key , V value ) )
→ Map <K , V >
Returns a new map with all entries that do not satisfy the given predicate
.
The entries in the resulting map do not
preserve the order of the original map.
rejectValues <K , V > (Iterable <V > values )
→ Map <K , V >
Filter where the value is not in the given values
.
Returns a new map with filtered entries.
removeExact ({required Object key , required Object value })
→ bool
Returns true
if the map contains the specified
key
and value
and removes the entry, false
otherwise.
shift <K , V > ()
→ MapEntry <K , V >
Shift the first entry from the map.
snakeCaseKeys <V > ()
→ Map <String , V >
Snake case all keys in the map.
Returns a new map with snake cased keys.
snakeCaseValues <K > ()
→ Map <K , String >
Snake case all values in the map.
Returns a new map with snake cased values.
suffixKeys <V > (String suffix )
→ Map <String , V >
Add suffix to all keys in the map.
Returns a new map with suffixed keys.
suffixValues <K > (String suffix )
→ Map <K , String >
Add suffix to all values in the map.
Returns a new map with suffixed values.
uniqueValues <K , V > ()
→ Map <K , V >
Remove duplicate values from the map.
Returns a new map with unique values.