public static List removeDuplicateWithOrder(List list) {
Set set = new HashSet();
List newList = new ArrayList();
for (Iterator iter = list.iterator(); iter.hasNext();) {
Object element = iter.next();
if (set.add(element)){
newList.add(element);
}
}
return newList;
}
------
public static List removeDuplicateWithOrder(List list) {
Set set = new HashSet(list.size());
set.addAll(list);
List newList = new ArrayList(set.size());
newList.addAll(set);
return newList;
}
----
public static List removeDuplicateWithOrder(List list) {
List newList = new ArrayList();
for (Object o : list) {
if (!newList .contains(o)) newList.add(o);
}
return newList;
}