Class ArrayUtils
java.lang.Object
ru.progrm_jarvis.javacommons.util.ArrayUtils
Utilities for working with arrays.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,R> R @NotNull [] map(T @NonNull [] source, @NonNull Function<? super T, ? extends R> mappingFunction, @NonNull IntFunction<? extends R @NotNull []> arrayFactory) Maps the given array by-element using the provided function.static <T,R> R @NotNull [] map(T @NonNull [] source, @NonNull Function<? super T, ? extends R> mappingFunction, @NonNull R... typeHint) Maps the given array by-element using the provided function.
-
Method Details
-
map
public static <T,R> R @NotNull [] map(T @NonNull [] source, @NonNull @NonNull Function<? super T, ? extends R> mappingFunction, @NonNull @NonNull IntFunction<? extends R @NotNull []> arrayFactory) Maps the given array by-element using the provided function.- Type Parameters:
T- the type of source elementsR- the type of target elements- Parameters:
source- source arraymappingFunction- function used to map elementsarrayFactory- function used to create a new array by its length- Returns:
- created array
-
map
public static <T,R> R @NotNull [] map(T @NonNull [] source, @NonNull @NonNull Function<? super T, ? extends R> mappingFunction, @TypeHint @NonNull @NonNull R... typeHint) Maps the given array by-element using the provided function.- Type Parameters:
T- the type of source elementsR- the type of target elements- Parameters:
source- source arraymappingFunction- function used to map elementstypeHint- pseudo-array of the same type as the target array- Returns:
- created array
-