This is a pretty common question, but I could not find this part:
Say I have this array list:
List arrayList = new List
public Set findDuplicates(List list) { Set items = new HashSet(); Set duplicates = new HashSet(); for (Object item : list) { if (items.contains(item)) { duplicates.add(item); } else { items.add(item); } } return duplicates; }