Skip to content

Commit

Permalink
Remove unnecessary null filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-tarjanyi committed May 5, 2018
1 parent 98c6f76 commit 96b3faa
Showing 1 changed file with 0 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.util.Objects;
import java.util.Set;

@RestController
Expand Down Expand Up @@ -44,7 +43,6 @@ public Flux<Person> getPersonsByStringNumber(@RequestParam Set<String> numbers)
{
return Flux.fromIterable(numbers)
.flatMap(number -> reactiveRedisTemplate.opsForValue().get(number).doOnNext(log::info))
.filter(Objects::nonNull)
.map(Integer::valueOf)
.flatMap(id -> mongoRepository.findById(id).doOnNext(person -> log.info(person.toString())))
.switchIfEmpty(Mono.error(new IllegalArgumentException("Not found person.")));
Expand Down

0 comments on commit 96b3faa

Please sign in to comment.