I am performing some maintenance tasks on an old system. I have an arraylist that contains following values:
a,b,12
c,d,3
b,a,12
d,e,3
a,b,12
I used following code to remove duplicate values from arraylist
ArrayList<String> arList;
public static void removeDuplicate(ArrayList arlList)
{
HashSet h = new HashSet(arlList);
arlList.clear();
arlList.addAll(h);
}
It works fine, if it finds same duplicate values. However, if you see my data carefully, there are some duplicate entries but not in same order. For example, a,b,12 and b,a,12 are same but in different order.
How to remove this kind of duplicate entries from arraylist?
Thanks