expandIndexed<R> method

ImmortalList<R> expandIndexed<R>(
  1. Iterable<R> f(
    1. int index,
    2. T value
    )
)

Returns a new list expanding each element of this list into a list of zero or more elements by applying f to each element and its respective index and concatenating the resulting lists.

See expand.

Implementation

ImmortalList<R> expandIndexed<R>(
  Iterable<R> Function(int index, T value) f,
) =>
    mapIndexed(f).expand(identity);