添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account
Mono.just("some") // `①`
                .flatMap(x -> {
                    if (x.length() > 5) return Mono.just(x);
                    else return Mono.empty();
                //want to get `some` from `①`
                .switchIfEmpty(Mono.just("empty"))
                .subscribe(System.out::print);

i want to when empty get previous value, how to do it?
any function as follow

Mono.just("some") // `①`
                .flatMap(x -> {
                    if (x.length() > 5) return Mono.just(x);
                    else return Mono.empty();
                //want to get `some` from `①`
                .onEmptyResume((x)->{ // onEmptyResume not exist
                    //this x is `some` from `①`
                .switchIfEmpty(Mono.just("empty"))
                .subscribe(System.out::print);