/* inlined function with parameterized types - twice as good! */ interface function { B f(A x); } public class thincrust { public static void main(String[] arg) { function F1, F2; function G; F1 = new function() { public int f(int x) { return x*x; }; }; F2 = new function() { public int f(int x) { return x+x; }; }; G = new function() { public double f(int x) { return x/3.14; } }; // closure function function Accumulator; Accumulator = new function() { private int ax = 0; public int f(int x) { ax +=x; return ax; } }; System.out.println(F1.f(5)); System.out.println(F2.f(5)); System.out.println(G.f(10)); System.out.println(Accumulator.f(10)); System.out.println(Accumulator.f(10)); } // main }