Applies a mapper function on a given collection and returns the results as a list. The resulting list is unmodifiable.
(Collection<? extends T> c,
Function<T, R> mapper)
| 43 | * the results as a list. The resulting list is unmodifiable. |
| 44 | */ |
| 45 | public static <T, R> List<R> map(Collection<? extends T> c, |
| 46 | Function<T, R> mapper) { |
| 47 | return c.isEmpty() ? List.of() : c.stream().map(mapper).toList(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Tests the elements in a given collection and returns a list of elements |
no test coverage detected