Class Functions2

java.lang.Object
org.eclipse.collections.impl.block.factory.Functions2

public final class Functions2 extends Object
Contains factory methods for creating Function2 instances.
  • Method Details

    • fromFunction

      public static <T, V, P> Function2<T,P,V> fromFunction(Function<? super T,? extends V> function)
    • throwing

      public static <T, V, P> Function2<T,P,V> throwing(ThrowingFunction2<T,P,V> throwingFunction2)
      Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Function2 that will throw a RuntimeException, wrapping the checked exception that is the cause.
    • throwing

      public static <T1, T2, V> Function2<T1,T2,V> throwing(ThrowingFunction2<T1,T2,V> throwingFunction2, Function3<T1,T2,? super Throwable,? extends RuntimeException> rethrow)
      Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Function2 that will throw a user specified RuntimeException based on the provided function. The function is passed the current element and the checked exception that was thrown as context arguments.
    • integerAddition

      public static Function2<Integer,Integer,Integer> integerAddition()
    • min

      public static <T> Function2<T,T,T> min(Comparator<? super T> comparator)
    • max

      public static <T> Function2<T,T,T> max(Comparator<? super T> comparator)
    • minBy

      public static <T, V extends Comparable<? super V>> Function2<T,T,T> minBy(Function<? super T,? extends V> function)
    • maxBy

      public static <T, V extends Comparable<? super V>> Function2<T,T,T> maxBy(Function<? super T,? extends V> function)