Categories
How to leave stream conditionally?
How to interrupt stream processing when a certain condition is reached? For example - to calculate the sum of elements, up to the first encountered zero?
Answer the question
In order to leave comments, you need to log in
Use takeWhile .
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question