Live data from Hacker News

Java 8 Lambdas

datumedge.blogspot.co.uk

1–10 of 144 posts

Re: Java 8 Lambdas

#4
post #2

Congratulations to the Java-programmers for getting a feature that virtually every other OOP language has had for about 10 years.

Care to elaborate? Ruby had them from day 1, PHP has only had them since 5.3, not sure what the deal is with python.

Re: Java 8 Lambdas

#6
post #4
post #2

Congratulations to the Java-programmers for getting a feature that virtually every other OOP language has had for about 10 years.

Care to elaborate? Ruby had them from day 1, PHP has only had them since 5.3, not sure what the deal is with python.

C# has had them for a little while now.

Re: Java 8 Lambdas

#9
'sorted()' doesn't really act like that, does it - taking in a comparator function?

It's much better to have comparator functions for the most common types baked in, and use projection to select a list of fields to use to compare with.

Comparator functions are very easy to get wrong. The example given here - ".sorted((a, b) -> a.getValue() - b.getValue())" - won't work properly when the calculation wraps around.

Re: Java 8 Lambdas

#10
post #4
post #2

Congratulations to the Java-programmers for getting a feature that virtually every other OOP language has had for about 10 years.

Care to elaborate? Ruby had them from day 1, PHP has only had them since 5.3, not sure what the deal is with python.

Python has lambdas and functions as first-order values since the beginning.
Post reply on HN