Like Stream.of(array).map(mapper).toArray(constructor) but without the entire stream pipeline.
(T[] array, ThrowingFunction<? super T, ? extends U, E> mapper, IntFunction<U[]> constructor)
| 2576 | * without the entire stream pipeline. |
| 2577 | */ |
| 2578 | static final <T, U, E extends Exception> U[] map(T[] array, ThrowingFunction<? super T, ? extends U, E> mapper, IntFunction<U[]> constructor) throws E { |
| 2579 | if (array == null) |
| 2580 | return constructor.apply(0); |
| 2581 | |
| 2582 | U[] result = constructor.apply(array.length); |
| 2583 | for (int i = 0; i < array.length; i++) |
| 2584 | result[i] = mapper.apply(array[i]); |
| 2585 | |
| 2586 | return result; |
| 2587 | } |
| 2588 | |
| 2589 | /** |
| 2590 | * Like <code>Stream.of(array).map(mapper).toArray(constructor)</code> but |
no test coverage detected