Skip to main content

All Questions

Tagged with
8 votes
0 answers
822 views

What lambda function optimizations, if any, are planned for Java 9 and beyond? [closed]

I'm working on a high-performance project where Java 8's lambda functions are enormously useful. I've found, however, that they're memory inefficient when used en masse. For example, suppose I need to ...
Dylan Knowles's user avatar
0 votes
1 answer
85 views

How confusing is `new SomeCollection(values...)::contains` as a Predicate? [closed]

Traditionally, a function that want to skip certain items during processing will accept a Collection or var-args argument, but in the Java 8 world I think I should switch to Predicates. Now, since ...
billc.cn's user avatar
  • 630
50 votes
4 answers
22k views

Why should I use "functional operations" instead of a for loop?

for (Canvas canvas : list) { } NetBeans suggests me to use "functional operations": list.stream().forEach((canvas) -> { }); But why is this preferred? If anything, it is harder to read and ...
Saturn's user avatar
  • 3,937
71 votes
3 answers
34k views

Is there a performance benefit to using the method reference syntax instead of lambda syntax in Java 8?

Do method references skip the overhead of the lambda wrapper? Might they in the future? According to the Java Tutorial on Method References: Sometimes... a lambda expression does nothing but call an ...
GlenPeterson's user avatar
  • 14.9k
31 votes
1 answer
17k views

Type inference in Java 8

Is the introduction of the new lambda notation (see e.g. this article) in Java 8 going to require some kind of type inference? If so, how will the new type system impact the Java language as a whole?
Giorgio's user avatar
  • 19.8k