Why do you need to store it in a List
? Do you actually require the data to be ordered or support index-based look-ups?
I would suggest storing the data in a Set
. If ordering is unimportant you should use HashSet
. However, if you wish to preserve ordering you could use LinkedHashSet
.