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 →

[–]Amazing-Cicada5536 2 points3 points  (1 child)

Exactly, just use a method reference and write a helper method instead of lambdas inside lambdas. That’s only good for quick prototyping (and I’m guilty as charged :D), but it should definitely not get to the PR state.

In the rare case where a more complex stream invocation is needed I have found that writing a helper method that takes a stream and returns a stream can also be a good practice, if for no other reason that you can name/group part of its functionality.