You could even replace .filter(event -> event != null) with .filter(Objects::nonNull) !
Another awesome note: when calling .parallel() on a stream, every further task in the pipeline gets executed in parallel using the default forkjoinpool, which uses exactly the number of cores available minus 1 (for the main thread). Awesome for speeding up tasks in some situations!
You're right. I created this based on an example with deeper nesting, and kept it in as I thought it might be easier to grasp for somebody new to the topic.
(1) I assumed it was because of a reason like that, but still wanted to give a hint for those who might appreciate it. I'd consider it a cleaner and more readable solution.
(2) This is definitely for more advanced users, but is such a powerfull tool, that I thought it should definitely be mentioned.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You could even replace .filter(event -> event != null) with .filter(Objects::nonNull) !
Another awesome note: when calling .parallel() on a stream, every further task in the pipeline gets executed in parallel using the default forkjoinpool, which uses exactly the number of cores available minus 1 (for the main thread). Awesome for speeding up tasks in some situations!
You're right. I created this based on an example with deeper nesting, and kept it in as I thought it might be easier to grasp for somebody new to the topic.
(1) I assumed it was because of a reason like that, but still wanted to give a hint for those who might appreciate it. I'd consider it a cleaner and more readable solution.
(2) This is definitely for more advanced users, but is such a powerfull tool, that I thought it should definitely be mentioned.