// "Collapse loop with stream 'forEach()'" "true-preview" import java.util.ArrayList; import java.util.List; import java.util.Objects; class Sample { List foo = new ArrayList<>(); { foo.stream().filter(Objects::isNull).forEach(s -> { return; }); } }