//js
function removeDumpicatedItem(arr){
var ret = [];
for(var i=0;i<arr.length;i++){
if(ret.indexOf(arr[i]==-1)){
ret.push(arr[i])
}
}
return ret;
}
//java(无序)
public static List removeDuplicate(List list){
HashSet hashSet = new HashSet(list);
list.clear();
list.add(hashSet);
return list;
}
//java(有序)
public static List removeDuplicate(List list){
List ret = new ArrayList();
for(int i=0;i<list.size();i++){
if(!ret.contains(list.get(i))){
ret.add(list.get(i))
}
}
return ret;
}
标签:List,java,hashSet,重复,小集,list,removeDuplicate,static,方法
From: https://blog.51cto.com/u_16021118/6442276