Java 8 lambdas execution
问题 How can I do something like this in Java 8? boolean x = ((boolean p)->{return p;}).apply(true); Right now I get the following error: The target type of this expression must be a functional interface 回答1: As per the JLS section 15.27: It is a compile-time error if a lambda expression occurs in a program in someplace other than an assignment context (§5.2), an invocation context (§5.3), or a casting context (§5.5). It is also possible to use a lambda expression in a return statement. We can