Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
javafu2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
javafu2
13y 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)). ... ```
2.
▲
by
javafu2
13y 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 o
3.
▲
by
javafu2
13y 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 anonymou
4.
▲
by
javafu2
13y 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.
5.
▲
by
javafu2
13y 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.
6.
▲
by
javafu2
13y 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.