Optional brackets around lambda expression (was: Expected distribution of lambda sizes)

Reinier Zwitserloot reinier at zwitserloot.com
Fri Jun 17 02:55:35 PDT 2011


On Fri, Jun 17, 2011 at 9:27 AM, Bob Foster <bobfoster at gmail.com> wrote:

>
> Ali Ebrahimi took the trouble to provide examples. Paren-less strawman?
>


As discussed in another thread; it's just like strawman, except the
parentheses around the expression are optional. Thus, official strawman
wants this:

Comparable<String> comparator = #(a, b) (a.length() - b.length());

and the paren-less variant lets you write this instead:

Comparable<String> comparator = #(a, b) a.length() - b.length();


More information about the lambda-dev mailing list