Skip to content

Commit

Permalink
Even better 👀
Browse files Browse the repository at this point in the history
  • Loading branch information
werli committed Dec 31, 2024
1 parent 1403f75 commit 5821073
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,7 @@ abstract static class FluxMapNotNullMapOptional<T, S> {

@BeforeTemplate
Flux<S> before(Flux<T> flux) {
return flux.map(x -> transformation(x))
.filter(Optional::isPresent)
.map(Optional::orElseThrow);
return flux.map(x -> transformation(x)).mapNotNull(x -> x.orElse(null));
}

@AfterTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,7 @@ ImmutableSet<Flux<Integer>> testFluxMapNotNull() {
}

Flux<String> testFluxMapNotNullMapOptional() {
return Flux.just(1)
.map(x -> Optional.of(x.toString()))
.filter(Optional::isPresent)
.map(Optional::orElseThrow);
return Flux.just(1).map(x -> Optional.of(x.toString())).mapNotNull(x -> x.orElse(null));
}

Flux<Integer> testFluxMapNotNullOptional() {
Expand Down

0 comments on commit 5821073

Please sign in to comment.