Class ArrayUtils

java.lang.Object
ru.progrm_jarvis.javacommons.util.ArrayUtils

public final class ArrayUtils extends Object
Utilities for working with arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 elements
      R - the type of target elements
      Parameters:
      source - source array
      mappingFunction - function used to map elements
      arrayFactory - 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 elements
      R - the type of target elements
      Parameters:
      source - source array
      mappingFunction - function used to map elements
      typeHint - pseudo-array of the same type as the target array
      Returns:
      created array