// "Collapse loop with stream 'collect()'" "true-preview" import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class Main { public void testPrimitiveMap(List data) { List list = data.stream().filter(str -> str.startsWith("xyz")).mapToInt(String::length).filter(len -> len > 10).boxed().collect(Collectors.toList()); } }