mapToListIndexed<T> method

List<T> mapToListIndexed<T>(
  1. List<T> destination,
  2. IndexedTransform<E, T> f
)

Transforms elements to objects of type T with the transformer f, providing sequential index of the element, and appends the result to the given destination.

Implementation

List<T> mapToListIndexed<T>(List<T> destination, IndexedTransform<E, T> f) {
  mapIndexed(f).forEach((e) => destination.add(e));
  return destination;
}