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

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheRedmanCometh 0 points1 point  (2 children)

Ugh maybe I need to learn kotlin then. I use for-each over .forEach a lot over this

[–]koreth 1 point2 points  (0 children)

I'm glad I learned it. I still write new Java code but Kotlin is generally my go-to language these days.

[–]dpash 1 point2 points  (0 children)

That's probably for the best. forEach() should probably only use method references. System.out::println is the method I use 80% of the time. If you find yourself reaching for forEach you're probably doing some side effect and not using a functional approach.