Let's say I have a function that takes a String and a long and returns a Single<String>.
Single<String> stringAddition(String someString, long value) {
return Single.just(someString + Long.toString(value));
}
Now I have this Observable...
Observable.interval(1, SECONDS)
.scan("", (cumulativeString, item) -> {
// Need to return the result of stringAddition(cummulativeString, item)
});
I'm at a loss on how to do this. Scan needs me to return a String, but II would like to use the method that returns a Single<String>. To me it seems like I need something that can combine the behaviour of both scan and flatMap. Is there any RxJava2 wizardry that can help me?