Expected distribution of lambda sizes (Re: Syntax poll, take 2)
Paul Benedict
pbenedict at apache.org
Tue Jun 14 06:30:12 PDT 2011
I don't see how long lambdas would help code. That's not more clear to
me than what already exists.
On Tue, Jun 14, 2011 at 7:02 AM, Collin Fagan <collin.fagan at gmail.com> wrote:
> Here are is a SAM types from the JDK written as if it a lambdas.
>
> straw man syntax
>
> Comparator<String> CASE_INSENSITIVE_ORDER = #(String s1, String s2) {
> int n1=s1.length(), n2=s2.length();
> for (int i1=0, i2=0; i1<n1 && i2<n2; i1++, i2++) {
> char c1 = s1.charAt(i1);
> char c2 = s2.charAt(i2);
> if (c1 != c2) {
> c1 = Character.toUpperCase(c1);
> c2 = Character.toUpperCase(c2);
> if (c1 != c2) {
> c1 = Character.toLowerCase(c1);
> c2 = Character.toLowerCase(c2);
> if (c1 != c2) {
> return c1 - c2;
> }
> }
> }
> }
> n1 - n2;
> };
>
More information about the lambda-dev
mailing list