How do I compare the values in ‘Mono’?

Tags: , ,

Comparing the values in Mono<Integer> a and Mono<Integer> b, if the value in Mono<Integer> a is larger, I want to throw an error.

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);

    .doOnNext(tuple -> {
        if (tuple.getT1() > tuple.getT2()) {
            throw new RuntimeException();

Source: stackoverflow