I have an ArrayList of custom objects. I want to remove duplicate entries.
The objects have three fields: title, subtitle, and id. If a su
title, subtitle
id
Update for Java8:
Using Java8 streams you can also do pretty trivally.
ArrayList deduped; deduped = yourArrayList.stream() .distinct() .collect(Collectors.toCollection(ArrayList::new));
This also has the advantage over going ArrayList → Set → ArrayList of maintaining ordering.