4 ms·
"Significantly" is a bit dramatic when we are talking about the difference between a single extra method call. One of the benefits of the Java version is it is
by djb_hackernews 12y ago
"Significantly" is a bit dramatic when we are talking about the difference between a single extra method call.
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)
- TranquilMarmot 12y agoIf you're writing a few hundred queries in a large appliaction, then that single extra method call will start to get awfully tedious to write over and over and over again. And talk about hurting readability, too... stream()! stream() everywhere! I'd say it's pretty significant.
- iwwr 12y ago>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. Are there professional programmers with only FP and no imperative language experience?
- hueyp 12y agoSelectMany is flatMap. Could the java equivalent be? articles.stream().flatMap(article -> article.getTags().stream()) Or is the previous map required?
- anton_gogolev 12y ago> "Significantly" is a bit dramatic when we are talking about the difference between a single extra method call. 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)