Last active
October 16, 2017 12:55
-
-
Save luks91/e6f454acd80589ee35f0aa903cb4c71b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun statefulIntegers() = Flowable.generate( | |
Callable<Int> { 0 }, | |
BiFunction<Int, Emitter<Int>, Int> { index, emitter -> | |
if (index < 100) { | |
emitter.onNext(index) | |
} else { | |
emitter.onComplete() | |
} | |
return@BiFunction index + 1 | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment