Is that the best way to implement a "TriFunction" without declaring an own Interface? And how is that construct called?
import java.util.function.BiFunction;
import java.util.function.Function;
public class Rec {
public static Function<Integer, Function<Integer, Function>> myPowerTriFunction = x -> y -> f -> y == 0 ? 1 : x * (Integer) ((Function<Integer, Function<Integer, Function>>) f).apply(x).apply(y - 1).apply(f);
public static BiFunction<Integer, Integer, Integer> myPowerBiFunction = (x, y) -> (Integer) myPowerTriFunction.apply(x).apply(y).apply(myPowerTriFunction);
public static void main(String[] args) {
System.out.println(myPowerBiFunction.apply(3, 5)); // Prints 243
}
}