Class Utils

java.lang.Object
com.norswap.nanoeth.utils.Utils

public final class Utils
extends Object
Misc general-purpose utilities that do not have a place in other utility classes.
  • Method Details

    • allDistinct

      @SafeVarargs public static <T> boolean allDistinct​(T... values)
      Returns true iff all supplies values are distinct.
    • map

      public static <T,​ R> R[] map​(T[] array, IntFunction<R[]> arraySupplier, Function<T,​R> f)
      Returns an array obtained by applying the function f to each item in array.

      The returned array is obtained by calling arraySupplier with the desired size.

    • mapThrowing

      public static <T,​ R> R[] mapThrowing​(T[] array, IntFunction<R[]> arraySupplier, Utils.ThrowingFunction<T,​R> f) throws Throwable
      Returns an array obtained by applying the function f to each item in array.

      The returned array is obtained by calling arraySupplier with the desired size.

      Throws:
      Throwable