//: innerclasses/LambdaExpressions.java import static net.mindview.util.Print.*; interface Description { String brief(); } interface Body { String detailed(String head); } interface Multi { String twoArg(String head, Double d); } public class LambdaExpressions { Description desc = new Description() { @Override public String brief() { return "Short info"; } }; Description desc2 = () -> "Short info"; Body bod = (h) -> h + " More details"; Body bod2 = h -> h + " No Parens!"; Multi mult = (h, n) -> h + n; // Parens are required with multiple args: // Multi mult2 = h, n -> h + n; // Nope public static void main(String[] args) { LambdaExpressions le = new LambdaExpressions(); print(le.desc.brief()); print(le.desc2.brief()); print(le.bod.detailed("Hi!")); print(le.bod2.detailed("Oh!")); print(le.mult.twoArg("Pi! ", 3.14159)); } } ///:~