Java tutorial
import java.util.function.IntFunction; public class Main { public static void main(String[] args) { IntFunction<Long> factorialCalc = Main::factorial; System.out.println(factorialCalc.apply(10)); } public static long factorial(int n) { if (n == 0) { return 1; } else { return n * factorial(n - 1); } } }