Skip to content

Commit

Permalink
How could I miss this
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Feb 20, 2023
1 parent e930c8b commit d13a5ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -701,12 +701,12 @@ static final class MonoThen<T> {
/** Prefer {@link Mono#singleOptional()} over more contrived alternatives. */
// XXX: Consider creating a plugin that flags/discourages `Mono<Optional<T>>` method return
// types, just as we discourage nullable `Boolean`s and `Optional`s.
static final class MonoCollectToOptional<T> {
static final class MonoSingleOptional<T> {
@BeforeTemplate
Mono<Optional<T>> before(Mono<T> mono) {
return Refaster.anyOf(
mono.map(Optional::of).defaultIfEmpty(Optional.empty()),
mono.flux().collect(toOptional()));
mono.flux().collect(toOptional()),
mono.map(Optional::of).defaultIfEmpty(Optional.empty()));
}

@AfterTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Mono<Void> testMonoThen() {
return Mono.just("foo").flux().then();
}

ImmutableSet<Mono<Optional<String>>> testMonoCollectToOptional() {
ImmutableSet<Mono<Optional<String>>> testMonoSingleOptional() {
return ImmutableSet.of(
Mono.just("foo").map(Optional::of).defaultIfEmpty(Optional.empty()),
Mono.just("bar").flux().collect(toOptional()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Mono<Void> testMonoThen() {
return Mono.just("foo").then();
}

ImmutableSet<Mono<Optional<String>>> testMonoCollectToOptional() {
ImmutableSet<Mono<Optional<String>>> testMonoSingleOptional() {
return ImmutableSet.of(Mono.just("foo").singleOptional(), Mono.just("bar").singleOptional());
}

Expand Down

0 comments on commit d13a5ed

Please sign in to comment.