java数组去重example:
String[] str={"john","lily","lily","lucy"}; List<String> list=new ArrayList<String>(); for(int i=0;i<str.length;i++){ if(!list.contains(str[i])){ list.add(str[i]); } }
时间: 2024-11-07 10:33:13
java数组去重example:
String[] str={"john","lily","lily","lucy"}; List<String> list=new ArrayList<String>(); for(int i=0;i<str.length;i++){ if(!list.contains(str[i])){ list.add(str[i]); } }