I realise that the Java 8 lambda implementation is subject to change, but in lambda build b39, I\'ve found that braces can only be omitted when the lambda expression returns
I have tried your code and for the most up-to-date JRE version I think it would be ok.
The following is what I reference from Oracle Java docs.
In a lambda expression, you must enclose statements in braces (
{}
). However, you do not have to enclose a void method invocation in braces.
For example, the following is a valid lambda expression:email -> System.out.println(email)
And the doc explains quite clearly. Hope this can solve your problem.
References: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html