Created
August 24, 2017 10:00
-
-
Save hkurokawa/aed6e97bbcfffd6ee14df22a09339548 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
import io.reactivex.Maybe; | |
import io.reactivex.Single; | |
import org.junit.Test; | |
public class SingleTest { | |
@Test public void testSingleConcat() { | |
Single<String> localSource = Single.create(emitter -> { | |
emitter.onError(new RuntimeException("1個目のError")); | |
}); | |
Single<String> remoteSource = Single.create(emitter -> { | |
emitter.onError(new RuntimeException("2個目のError")); | |
}); | |
Maybe.concat(localSource.toMaybe().onErrorComplete(), remoteSource.toMaybe()) | |
.firstOrError() | |
.subscribe(System.out::println, System.err::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment