HN user

javafu2

22 karma
Posts0
Comments6
View on HN
No posts found.
Streams in Java 8 12 years ago

It already exists in the API. Your type Projection is a Function, and by is called comparing in interface Comparator.

so one can write: ``` contries.sorted(comparingInt(Country::getPopulation)). ... ```

Streams in Java 8 12 years ago

For most of the used programming languages, a lambda captures values (like in Java or Python), and closure capture variables or scope (like in Scheme or Ruby), hence the name, a closure close (bind) the free variable of the closure to the ones of the lexical scope.

The lack of checked exception transparency is for me something that goes in the right direction. The hidden message is 'Use checked exception only for IOs and please don't create your own exceptions, use already existing ones !'

Streams in Java 8 12 years ago

In my opinion, lambdas were not introduced in Java before now because Java as already anonymous classes that are at a high level conceptually the same things even if a lambda is more lightweight syntactically and at runtime than an anonymous class

Streams in Java 8 12 years ago

checked exceptions :), sorry just kidding.

mainly wildcards, you can design an interface which is covariant and contravariant, and real interference when calling a generic method.

Streams in Java 8 12 years ago

You can not modified a variable declared in the outer scope inside a lambda.

int a = 0; list.forEach(element -> { a++; // no way ! });

That's why it's a lambda and not a closure BTW.

Streams in Java 8 12 years ago

F# team ask for modifications of the CLR (covariant delegates), porting a language on the CLR if you are not Microsoft is hard.

Scala never really run on the CLR, it's a vaporware, sorry a work in progress.