Stream<Person> () { return repository.all() .flatMap(foo -> { class AB { List<String> a() { return new <warning descr="Unchecked assignment: 'java.util.ArrayList' to 'java.util.List<java.lang.String>'">ArrayList</warning>(); } } AB ab = new AB(); System.out.println(ab); if (foo != null) { return repository.update(); } return Stream.empty(); }) .map(UpdateResult::getPerson); }