In real time scenarios, you encountered the cases having duplicate objects in a list. To remove the duplicates, There are no java Collections List implementations to solve this. In Collections, List allows duplicate values and maintain the insertion order, whereas Set does not allow duplicates, doesn’t maintain order.
To achieve this, We can do this in a number of ways.
apache common-collection API provided org.apache.commons.collections.list.SetUniqueList method is used to avoid duplicates in a list
Anonymous - Jan 2, 2012
If you need the insertion order you can use java.util.LinkedHashSet.