deepForEach

inline fun <A : Iterable<B>, B, C> A.deepForEach(extractor: B.() -> Iterable<C>, body: (C) -> Unit)

Given an Iterable receiver, run the normal forEach operation to produce a series of values, apply the extractor extension function to each of those values to produce an Iterable for each of them, and run forEach on those Iterables, in order, using the body function.

Receiver

The outer Iterable to visit.

Parameters

extractor

A transformation from values produced by the receiver to an Iterable that should be visited with the body.

body

The function to run with each value produced by each of the invocations of the extractor on each element of the receiver Iterable.


inline fun <A : Iterable<B>, B, C, D> A.deepForEach(    extractor1: B.() -> Iterable<C>,     extractor2: C.() -> Iterable<D>,     body: (D) -> Unit)

Given an Iterable receiver, run the normal forEach operation to produce a series of values, apply the extractor1 extension function to each of those values to produce an Iterable for each of them, run the extractor2 extension function to produce an Iterable to run forEach on, with the body function.

and run forEach on those Iterables, in order.

Receiver

The outer Iterable to visit.

Parameters

extractor1

A transformation from values produced by the receiver to an Iterable that should be visited.

extractor2

A transformation from values produced by the extractor1's iterator, to an Iterable that should be visited with the body.

body

The function to run with each value produced by each of the invocations of the extractor2 on each element produced by the extractor1 on each element of the receiver Iterable.