mapIndexedTo<R> method
Applies the given transform
function to each element and its index in the original collection
and appends the results to the given destination
.
@param transform
function that takes the index of an element and the element itself
and returns the result of the transform applied to the element.
Implementation
List<R> mapIndexedTo<R>(List<R> destination, R Function(int, T) transform) {
var index = 0;
for (var item in this) {
destination.add(transform(index++, item));
}
return destination;
}