void (List<String> data) { List<String> xyz = new ArrayList<>(); boolean dropping = true; OUTER: for (String s : data) { for (String string : Arrays.asList(s, s + s)) { if (string.isEmpty()) { break OUTER; } if (dropping) { if (string.length() < 3) { continue; } dropping = false; } xyz.add(string); } } System.out.println(xyz); }