In old Java, it really was a class. In new Java, I'm not 100% sure anymore, but with verbose syntax it'll be an class. I made it as verbose as possible:
Function<Integer, Integer> adder(int x) { class Adder implements Function<Integer, Integer> { int x1; @Override Integer apply(Integer y) { return x1 + y; } } Adder adder = new Adder(); adder.x1 = x; return adder; }
Function<Integer, Integer> adder(int x) { return (y) -> x + y; }
In old Java, it really was a class. In new Java, I'm not 100% sure anymore, but with verbose syntax it'll be an class. I made it as verbose as possible:
and a bit less verbose with modern Java: So closure could be definitely be considered as a very simple class.