New answers tagged lambda
If anything, it is harder to read and understand. That is highly subjective. I find the second version much easier to read and understand. It matches how other languages (e.g. Ruby, Smalltalk, Clojure, Io, Ioke, Seph) do it, it requires fewer concepts to understand (it's just a normal method call like any other, whereas the first example is specialized ...
Another advantage of using the functional streaming API is, that it hides implementation details. It only describes what should be done, not how. This advantage becomes obvious when looking at the change that needs to be done, to change from single threaded to parallel code execution. Just change the .stream() to .parallelStream().
Streams provide much better abstraction for composition of different operations you want to do on top of collections or streams of data coming in. Exspecially when you need to map elements, filter and convert them. Your example is not very practical. Consider following code from Oracle site. List<Transaction> groceryTransactions = new ...
Top 50 recent answers are included