📅  最后修改于: 2022-03-11 14:52:48.404000             🧑  作者: Mango
// Given a list of Integers 1, 2, 3, 4, 5, 6 ....etc. remove all values greater than 100.
public static void main(String[] args) {
ArrayListlist1=new ArrayList<>(Arrays.asList(1,2,3,50,70,80,120,150,200));
ArrayListlist2 = new ArrayList<>();
for(int each : list1)
if(each<100)
list2.add(each);
list1 = list2;
System.out.println(list1); // [1, 2, 3, 50, 70, 80]
}