flatMapTo<R, C extends KtMutableCollection<R>> method

C flatMapTo<R, C extends KtMutableCollection<R>>(
  1. C destination,
  2. KtIterable<R> transform(
    1. T
    )
)

Appends all elements yielded from results of transform function being invoked on each element of original collection, to the given destination.

Implementation

C flatMapTo<R, C extends KtMutableCollection<R>>(
    C destination, KtIterable<R> Function(T) transform) {
  for (final element in iter) {
    final list = transform(element);
    destination.addAll(list);
  }
  return destination;
}