/** ?
?* 通过HashSet踢除重复元素除去List集合中的重复数据 ?
* */ ???
public static List<Integer> removeDuplicate(List<Integer> list)?
{ ???????
? HashSet<Integer> h = new? HashSet<Integer>(list); ???????
list.clear(); ???????
list.addAll(h); ???????
? return list; ????
} ?
/** ?
* 写个去除数组中重复数据的方法 ?
?* */ ?
public static String[] array_unique(String[] a)
{?? ????
? // array_unique?? ????
List<String> list = new LinkedList<String>();?? ????
for(int i = 0; i < a.length; i++) {?? ????????
?if(!list.contains(a[i]))
{?? ????????????
list.add(a[i]);?? ????????
? }?? ????
?}?? ????
return (String[])list.toArray(new String[list.size()]);??
?}?