13 lines
383 B
Java
13 lines
383 B
Java
import reactor.core.publisher.Mono;
|
|
|
|
public class test_mono {
|
|
public static void main(String[] args) {
|
|
Mono<String> source = Mono.empty();
|
|
Mono<String> m = source
|
|
.flatMap(s -> Mono.just("from flatMap " + s))
|
|
.switchIfEmpty(Mono.defer(() -> Mono.just("from switchIfEmpty")));
|
|
|
|
m.subscribe(System.out::println);
|
|
}
|
|
}
|