ArrayLists and lists are not designed to avoid duplicates at all, they are designed as a type of collection that maintains the order of multiple elements. If you want the collection to be more appropriate for the assignment, you need a set:
Set<String> set = new HashSet<String>();
, , . : , , equals()
hashcode()
, .
, , LinkedHashSet
.