asMapWithKeys<K> method
Returns an ImmortalMap using the given keyGenerator
.
Iterates over all elements and creates the key for each element by
applying keyGenerator
to its value.
If a key is already present in the map, the corresponding value is
overwritten.
Implementation
ImmortalMap<K, T> asMapWithKeys<K>(K Function(T value) keyGenerator) =>
ImmortalMap.fromEntries(toImmortalList().map(
(value) => MapEntry(keyGenerator(value), value),
));