Class BinaryFunction

    • Constructor Detail

      • BinaryFunction

        public BinaryFunction()
    • Method Detail

      • instanceOf

        public static BinaryFunction instanceOf​(java.util.function.BiFunction<java.lang.Object,​java.lang.Object,​? super java.lang.Object> fun)
        Create a BinaryFunction from a lambda expression where arguments can be Objects. For example BinaryFunction.instanceOf((x,y) -> ((Number) x).doubleValue() + ((Number) y).doubleValue())
        Parameters:
        fun - the lambda function
        Returns:
        a new BinaryFunction instance
        Since:
        Jep 4.0
      • instanceOf

        public static <T> BinaryFunction instanceOf​(java.lang.Class<T> type,
                                                    java.util.function.BiFunction<T,​T,​? super java.lang.Object> fun)
        Create a BinaryFunction from a lambda expression where both arguments are of a specified type. For example BinaryFunction.instanceOf(Integer.class, (x,y) -> x * y) The eval(Object,Object) method will throw an IllegalParameterException if either argument is not of the correct type.
        Type Parameters:
        T - type of arguments and return value
        Parameters:
        type - type of the arguments
        fun - the lambda function
        Returns:
        a new BinaryFunction instance
        Since:
        Jep 4.0