[英]How do I compare the values in 'Mono'?
比較Mono<Integer> a
和Mono<Integer> b
中的值,如果Mono<Integer> a
中的值更大,我想拋出一個錯誤。
Mono<Integer> a = getA();
Mono<integer> b = getB();
if(a > b) {
throw new RuntimeException();
}
Mono<Integer> a = Mono.just(12);
Mono<Integer> b = Mono.just(10);
a.zipWith(b)
.doOnNext(tuple -> {
if (tuple.getT1() > tuple.getT2()) {
throw new RuntimeException();
}
}).subscribe();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.