Help please, How to summarize two Single<Optional> in java 11 ?
I am using RxJava but I don't think it means anything.
for example:
Single<Optional<MonetaryAmount>> first = someMethod1(a, b);
Single<Optional<MonetaryAmount>> second = someMethod2(a, b);
I want to do something like this not syntactically but logically
Single<Optional<MonetaryAmount>> result = first + second;
I tried to do something like this but it doesn't work in java 11
Single<Optional<MonetaryAmount>> result = Stream.concat(first, second)
.reduce(MonetaryAmount::sum);
Do you have some idea ?
question from:https://stackoverflow.com/questions/65916695/java-11-how-to-summarize-two-singleoptional-in-java