takeWhile

Pass elements downstream as long as a predicate function return true for the element include the element when the predicate first return false and then complete.

Simple operators

Signature

def takeWhile(p: Out => Boolean): Repr[Out]
def takeWhile(p: Out => Boolean, inclusive: Boolean): Repr[Out]

Description

Pass elements downstream as long as a predicate function return true for the element include the element when the predicate first return false and then complete.

emits while the predicate is true and until the first false result

backpressures when downstream backpressures

completes when predicate returned false or upstream completes

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.