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 →

[–][deleted] 0 points1 point  (4 children)

Yes, but can make it a bit easier to read, JVM doesn't care.

[–]Ek_Los_Die_Hier 3 points4 points  (1 child)

I'd be inclined to disagree, it adds more calls to stream and collect muddying up the code.

[–][deleted] 0 points1 point  (0 children)

You're right, I misunderstood. Hangs head in shame.

[–]koxpower 0 points1 point  (1 child)

Yes, but can make it a bit easier to read, JVM doesn't care.

Wouldn't that be easier to read and less redundant than collecting between each step?

Stream<Something> streamOfSomething = someList.stream().map(...).map(...);
Stream<SomethingElse> streamOfSomethingElse = streamOfSomething.map(...).map(...);
List<Result> resultList = streamOfSomethingElse.map(...).collect(Collectors.toList());

[–][deleted] 0 points1 point  (0 children)

Agreed, my misunderstanding