Like Stream.of(array).map(mapper).toList() but without the entire stream pipeline.
(Iterable<? extends T> it, ThrowingFunction<? super T, ? extends List<? extends U>, E> mapper)
| 2716 | * without the entire stream pipeline. |
| 2717 | */ |
| 2718 | static final <T, U, E extends Exception> List<U> flatMap(Iterable<? extends T> it, ThrowingFunction<? super T, ? extends List<? extends U>, E> mapper) throws E { |
| 2719 | if (it == null) |
| 2720 | return emptyList(); |
| 2721 | |
| 2722 | List<U> result = newListWithCapacity(it); |
| 2723 | for (T t : it) |
| 2724 | result.addAll(mapper.apply(t)); |
| 2725 | |
| 2726 | return result; |
| 2727 | } |
| 2728 | |
| 2729 | /** |
| 2730 | * Like <code>Stream.of(array).zipWithIndex().map(mapper).toList()</code> |
no test coverage detected