I have the below code from the answer given in this [stackoverflow question]
bars = bars.flatMap(bar -> findByBarId(bar.getBarId())
.flatMap(foo -> {
bar.setIsInFoo(true);
return Mono.just(bar);
}).switchIfEmpty(Mono.just(bar)));
How to do above if I had single Mono<Bar> bar Mono<Foo> foo
instead of Flux variant above and to get modified bar ?