associateWith<V> method
Returns a Map containing the values returned from valueSelector
function
applied to each element indexed by the elements from the collection.
If any of elements (-> keys) would be the same the last one gets added to the map.
Implementation
Map<E, V> associateWith<V>(V Function(E element) valueSelector) {
var map = <E, V>{};
for (var current in this) {
map[current] = valueSelector(current);
}
return map;
}