private static List<Integer> filter(List<Integer> list){ Iterator<Integer> it = list.iterator(); while(it.hasNext()){ if(it.next() > 5) it.remove(); } return list; }