associateBy<K> method
Returns a Map containing the values provided by valueTransform
and indexed by keySelector
functions applied to elements of the given collection.
If any two elements would have the same key returned by keySelector
the last one gets added to the map.
The returned map preserves the entry iteration order of the original collection.
Implementation
Map<K, T> associateBy<K>(K Function(T) keySelector) {
return associateByTo({}, keySelector);
}