Linq-like features in Java 8

Linq-like features in Java 8

Introduces “Streams” to remove for loops.  

I wonder how it performs compared to for loops?

#java   #linq

7 thoughts on “Linq-like features in Java 8

  1. Going wild with lambdas 😀

    Some code examples make me wonder why some methods don’t have an overload. It’s like you would write .Where(…).First in C# but actually First is overloaded to take a delegate, so you just write .First(…).

    Though I am jealous of the Optional. I want monads in Delphi 😦

    Best example is the grouping into the map. That one is nice!

    But comments like “better later that never…” or “welcome to 2007.” make me sulk.


  2. We do something very similar in Mitov.Runtime. We almost don’t use loops any more in our code.

    It is done with the Query method on very much all collections in Mitov.Runtime as well as the helpers for number of existing collections in Delphi


  3. Lars Fosdal In most cases performance is the same but using streams you get parallelization for free (just use parallelStream() instead of stream()). It can sound controversial at first but I mostly agree with Michael Feathers that “More languages need to be designed without looping constructs.”


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.