Here are two methods that allow you to remove duplicates in an ArrayList
/** List order not maintained **/
public static void removeDuplicate(ArrayList arlList)
{
HashSet h = new HashSet(arlList);
arlList
arlList
}
/** List order maintained **/
public static void removeDuplicateWithOrder(ArrayList arlList)
{
Set set = new HashSet();
List newList = new ArrayList();
for (Iterator iter = erator(); iter
{
Object element = iter
if (set
}
arlList
arlList
}
From:http://tw.wingwit.com/Article/program/Java/gj/201311/27380.html