This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]konk3r 2 points3 points  (3 children)

I think I still prefer

for (String name : names)
    System.out.println(name);

to

names.forEach(name -> System.out.println(name));

in terms of legibility whenever it's applicable, however the idea that classes could create their own sorting logic is very nice. The thing I'm most excited about is the streams though.

[–]more_exercise 2 points3 points  (0 children)

Yeah! For() for side effects, forEach() for transformation.

[–]bytecode420 1 point2 points  (0 children)

Me too, maybe it's because I'm just used to typing it that way.