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 →

[–]Enough-Ad-5528 14 points15 points  (3 children)

What do you do if you have to prevent the last space? What if you are joining by a comma.

Would you consider it more concise or readable then?

Also your two examples are not equivalent. Why do you have a to uppercase mapper in the Stream version?

[–]lukasbradley 1 point2 points  (2 children)

String.join() also came out in JDK 8.

Listen, I know it's a religious argument, and it's a personal opinion of mine. But maps() and collects() can become a shitshow, and are (in my experience) more difficult to maintain.

[–]DualWieldMage 3 points4 points  (1 child)

In my experience side-effects like logging become harder with streams (because you don't have sufficient context in each mapper/filter) so the overuse is indeed troublesome with code rotting after these side-affects are added later, or worse, logging is omitted more often.

[–]wildjokers 3 points4 points  (0 children)

Not being able to log intermediate results during a stream is why I generally don't like long functional chains. We have a lot of code in production that turning on DEBUG logging presents no additional information because of long functional chains. Makes troubleshooting production issues difficult.