[Java] 纯文本查看 复制代码 ArrayList<String> list = new ArrayList<>();
list.add("瞧瞧");
list.add("瞧瞧");
list.add("方法");
list.add("覆盖");
list.add("淘汰");
list.add("引用");
ArrayList<String> l1 = new ArrayList<>();
Iterator<String> iterator = list.iterator();
while (iterator.hasNext()){
String next = iterator.next();
if(!l1.contains(next)){
l1.add(next);
}
}
System.out.println(l1);
|