Created
October 9, 2018 23:04
-
-
Save zsoltk/6426b6b5dc3567988d47f494605af23a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
val output: PublishSubject<String> = PublishSubject.create() | |
val input: Consumer<String> = Consumer { System.out.println(it) } | |
val lifecycle = ManualLifecycle() | |
val binder = Binder(lifecycle) | |
binder.bind(output to input) | |
output.onNext("1") | |
lifecycle.begin() | |
output.onNext("2") | |
output.onNext("3") | |
lifecycle.end() | |
output.onNext("4") | |
lifecycle.begin() | |
output.onNext("5") | |
output.onNext("6") | |
lifecycle.end() | |
output.onNext("7") | |
// will print: | |
// 2 | |
// 3 | |
// 5 | |
// 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment