KtcMap<K , V > extension
Methods
any ([bool test (MapEntry <K , V > entry )? ])
→ bool
Returns true
if at least one entry passes the given test
or Map has
at least one entry.
every (bool test (MapEntry <K , V > entry ) )
→ bool
Returns true
if all entries pass the given test
.
firstNotNullOf <R > (R? transform (MapEntry <K , V > entry ) )
→ R
Returns the first non-null value produced by transform
function being
applied to entries of this Map in iteration order, or throws
NoSuchElementException if no non-null value was produced.
firstNotNullOfOrNull <R > (R? transform (MapEntry <K , V > entry ) )
→ R?
Returns the first non-null value produced by transform
function being
applied to entries of this Map in iteration order, or null if no
non-null value was produced.
flatMap <R > (Iterable <R > transform (MapEntry <K , V > entry ) )
→ Iterable <R >
Returns a single Iterable of all elements yielded from results of
transform
function being invoked on each entry of original Map .
getOrDefault (K key , V defaultValue )
→ V
Returns the value corresponding to the given key
, or defaultValue
if
such a key
is not present in the Map .
getOrElse (K key , V defaultValue () )
→ V
Returns the value for the given key
, or the result of the defaultValue
function if there was no entry for the given key
.
mapEntries <R > (R transform (MapEntry <K , V > entry ) )
→ Iterable <R >
Returns a Iterable containing the results of applying the given
transform
function to each entry in the original Map .
mapKeys <R > (R transform (MapEntry <K , V > entry ) )
→ Map <R , V >
Returns a new Map with entries having the keys obtained by applying the
transform
function to each entry in this Map and the values of this
Map .
mapNotNull <R > (R? transform (MapEntry <K , V > entry ) )
→ Iterable <R >
Returns a Iterable containing only the non-null results of applying the
given transform
function to each entry in the original Map .
mapValues <R > (R transform (MapEntry <K , V > entry ) )
→ Map <K , R >
Returns a new Map with entries having the keys of this Map and the
values obtained by applying the transform
function to each entry in this
Map .
maxByOrNull <R extends Comparable > (R selector (MapEntry <K , V > entry ) )
→ MapEntry <K , V > ?
Returns the first entry yielding the largest value of the given function
or null
if there are no entries.
maxOf <R extends Comparable > (R selector (MapEntry <K , V > entry ) )
→ R
Returns the largest value among all values produced by selector
function
applied to each entry in the Map .
maxOfOrNull <R extends Comparable > (R selector (MapEntry <K , V > entry ) )
→ R?
Returns the largest value among all values produced by selector
function
applied to each entry in the Map or null
if there are no entries.
maxOfWith <R > (Comparator <R > comparator , R selector (MapEntry <K , V > entry ) )
→ R
Returns the largest value according to the provided comparator
among all
values produced by selector
function applied to each entry in the Map .
maxOfWithOrNull <R > (Comparator <R > comparator , R selector (MapEntry <K , V > entry ) )
→ R?
Returns the largest value according to the provided comparator
among all
values produced by selector
function applied to each entry in the map or
null
if there are no entries.
maxWithOrNull (Comparator <MapEntry <K , V > > comparator )
→ MapEntry <K , V > ?
Returns the first entry having the largest value according to the provided
comparator
or null
if there are no entries.
minByOrNull <R extends Comparable > (R selector (MapEntry <K , V > entry ) )
→ MapEntry <K , V > ?
Returns the first entry yielding the smallest value of the given function
or null
if there are no entries.
minOf <R extends Comparable > (R selector (MapEntry <K , V > entry ) )
→ R
Returns the smallest value among all values produced by selector
function applied to each entry in the Map .
minOfOrNull <R extends Comparable > (R selector (MapEntry <K , V > entry ) )
→ R?
Returns the smallest value among all values produced by selector
function applied to each entry in the Map or null
if there are no
entries.
minOfWith <R > (Comparator <R > comparator , R selector (MapEntry <K , V > entry ) )
→ R
Returns the smallest value according to the provided comparator
among
all values produced by selector
function applied to each entry in the
Map .
minOfWithOrNull <R > (Comparator <R > comparator , R selector (MapEntry <K , V > entry ) )
→ R?
Returns the smallest value according to the provided comparator
among
all values produced by selector
function applied to each entry in the
Map or null
if there are no entries.
minWithOrNull (Comparator <MapEntry <K , V > > comparator )
→ MapEntry <K , V > ?
Returns the first entry having the smallest value according to the
provided comparator
or null
if there are no entries.
none ([bool test (MapEntry <K , V > entry )? ])
→ bool
Returns true
if the map has no entries.
onEach (void action (MapEntry <K , V > entry ) )
→ Map <K , V >
Performs the given action
on each entry and returns the Map itself
afterwards.
onEachIndexed (void action (int index , MapEntry <K , V > entry ) )
→ Map <K , V >
Performs the given action
on each entry, providing sequential index with
the entry, and returns the Map itself afterwards.
where (bool test (MapEntry <K , V > entry ) )
→ Map <K , V >
Returns a new Map containing all key-value pairs passing the given
test
.
whereKeys (bool test (K key ) )
→ Map <K , V >
Returns a Map containing all key-value pairs with keys passing the given
test
.
whereNot (bool test (MapEntry <K , V > entry ) )
→ Map <K , V >
Returns a new Map containing all key-value pairs not passing the given
test
.
whereValues (bool test (V value ) )
→ Map <K , V >
Returns a Map containing all key-value pairs with values passing the
given test
.
Operators
operator + (Iterable <MapEntry <K , V > > entries )
→ Map <K , V >
Creates a new Map by replacing or adding entries to this Map from a
given collection of key-value entries
.
operator - (Iterable <K > keys )
→ Map <K , V >
Returns a Map containing all entries of the original Map except those
entries the keys of which are contained in the given keys
collection.