by djb_hackernews · 11y ago · 0 comments
One of the benefits of the Java version is it is easier to understand if you don't have a Java background but do have an FP background. With your C# example you'd need to find the documentation to find out what SelectMany does (which is probably just a helper method that abstracts a map and flatMap call)
Are there professional programmers with only FP and no imperative language experience?
It's not just a single method call; it's the entire approach. This entire method chain is something that cannot be done in Java as cleanly as it is in C#. Grouping is a prime example. Compare
articles.stream().collect(Collectors.groupingBy(Article::getAuthor))
with articles.GroupBy(a => a.Author)Could the java equivalent be?
articles.stream().flatMap(article -> article.getTags().stream())
Or is the previous map required?