flatMapIndexedTo<R, C extends KtMutableCollection<R> > method
C
flatMapIndexedTo<R, C extends KtMutableCollection<R> >(
- C destination,
- KtIterable<
R> transform(- int index,
- T
Appends all elements yielded from results of transform
function being
invoked on each element and its index in the original collection, to the
given destination
.
Implementation
C flatMapIndexedTo<R, C extends KtMutableCollection<R>>(
C destination, KtIterable<R> Function(int index, T) transform) {
var index = 0;
for (final element in iter) {
final list = transform(index++, element);
destination.addAll(list);
}
return destination;
}