// "Collapse loop with stream 'sum()'" "true-preview"

import java.util.List;

public class Main {
  public void testPrimitiveMap(List<String> data) {
    int sum;
    if(Math.random() > 0.5) {
      sum = 10;
    } else {
        sum = data.stream().filter(str -> str.startsWith("xyz")).mapToInt(String::length).filter(len -> len > 10).map(len -> len * 2).sum();
    }
    System.out.println(sum);
  }
}