News for hackers. Stuff that matters.
Re:Java 8 lambda syntax decided - same as C# and Scala by linuxhansl on Thursday September 08, 2011 @10:25PM (#2976515)
Big deal:

    new Thread(new Runnable() { public void run() {doStuff();} }).start();
Re:Java 8 lambda syntax decided - same as C# and Scala by ppog on Thursday September 08, 2011 @11:08PM (#2976618)
But for a small function (which a lambda typically is), the syntactic overhead of "new Runnable() { public void run()" swamps the actual logic. When I read this version, it's hard for my eyes to find what work is actually being done because there are so many braces and brackets and words. The big deal of lambda syntax is that it lets you focus on the code that does the work (the doStuff) instead of the adapter (the "new Runnable() { public void run()") that the library needs around that code.
Re:Java 8 lambda syntax decided - same as C# and Scala by cbs on Friday September 09, 2011 @09:42AM (#2978046)
it's hard for my eyes to find what work is actually being done

Aside from if a lambda expression or anonymous class is the better choice overall, this just happens to be a case that you're just not familiar with the syntax. Its been years since I've done any work in java, but I read this over some coffee and didn't even slow down for it.

Lambdas will be nice for the situations where there is more boilerplate than implementation, but the anonymous inner class in java isn't going to die.

Re:Java 8 lambda syntax decided - same as C# and Scala by moomin on Friday September 09, 2011 @09:34AM (#2978022)
Cool. Now how about

companies .Where(c => c.Name.StartsWith("A")) .GroupBy(c => c.Sector, c => c.ProfitAndLoss) .Select(g => new {Sector = g.Key, Profitability = g.Sum()}

Closures are massively more compact than running around with inner classes for everything.