Hacker News new | ask | show | jobs
by LgWoodenBadger 3399 days ago
Idiomatic Java hasn't preferred Arrays since the advent of the Collections API back in 1.2.

Idiomatic Java as of 1.8 now has flatMap on Streams, which all Collection implementations provide.

1 comments

I don't disagree. I was thinking about how Java is typically taught in computer science contexts where Fortran in any language is not uncommon because that context seemed the relevant one to nest inside the context of junior programmers using Java.

One of the difficulties of learning Java is that because it has been around so long, old idioms live on on the internet. For example, the Java examples of flatteing a list (which I recently looked at) do not include flatmapping a stream. It does not surprise me that it is there since I believe Java is an incredible and sophisticated language.