Java has the Optional::stream function, and streams have flatMap. These two together will let you write java code that is very similar to the JavaScript code in https://softwareengineering.stackexchange.com/a/387859/3307
values.stream()
.flatMap( v -> (include(v) ? Optional.empty() : Optional.of(v*2)).stream() )
// added some parens