zipTransform<R, V> method

KtList<V> zipTransform<R, V>(
  1. KtIterable<R> other,
  2. V transform(
    1. T a,
    2. R b
    )
)

Returns a list of values built from the elements of this collection and the other collection with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Implementation

KtList<V> zipTransform<R, V>(
    KtIterable<R> other, V Function(T a, R b) transform) {
  final first = iterator();
  final second = other.iterator();
  final list = mutableListOf<V>();
  while (first.hasNext() && second.hasNext()) {
    list.add(transform(first.next(), second.next()));
  }
  return list;
}