I have a situation where I will be receiving 2+ ArrayList and I need to be able to merge all the lists and remove any duplicate Widget so
Use Set Collection Class,
ArrayList mergeList = new ArrayList();
mergeList.addAll(widgets1);
mergeList.addAll(widgets2);
Set set = new HashSet(mergeList);
ArrayList mergeListWithoutDuplicates = new ArrayList();
mergeListWithoutDuplicates .addAll(set);
return mergeListWithoutDuplicates;
Now here Set will remove all duplicates values from your ArrayList.