Class Functions2


  • public final class Functions2
    extends java.lang.Object
    Contains factory methods for creating Function2 instances.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static Function2<java.lang.Integer,​java.lang.Integer,​java.lang.Integer> INTEGER_ADDITION  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Functions2()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​V,​P>
      Function2<T,​P,​V>
      fromFunction​(Function<? super T,​? extends V> function)  
      static Function2<java.lang.Integer,​java.lang.Integer,​java.lang.Integer> integerAddition()  
      static <T> Function2<T,​T,​T> max​(java.util.Comparator<? super T> comparator)  
      static <T,​V extends java.lang.Comparable<? super V>>
      Function2<T,​T,​T>
      maxBy​(Function<? super T,​? extends V> function)  
      static <T> Function2<T,​T,​T> min​(java.util.Comparator<? super T> comparator)  
      static <T,​V extends java.lang.Comparable<? super V>>
      Function2<T,​T,​T>
      minBy​(Function<? super T,​? extends V> function)  
      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.
      static <T1,​T2,​V>
      Function2<T1,​T2,​V>
      throwing​(ThrowingFunction2<T1,​T2,​V> throwingFunction2, Function3<T1,​T2,​? super java.lang.Throwable,​? extends java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INTEGER_ADDITION

        private static final Function2<java.lang.Integer,​java.lang.Integer,​java.lang.Integer> INTEGER_ADDITION
    • Constructor Detail

      • Functions2

        private Functions2()
    • Method Detail

      • 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 java.lang.Throwable,​? extends java.lang.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<java.lang.Integer,​java.lang.Integer,​java.lang.Integer> integerAddition()
      • min

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

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

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

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