"Well," I said to myself. That's easy enough to fix. I can just add a hashCode() (and matching equals()) method to the class for the members that are being added to the list; then add a HashSet to keep track of what's already in the list, because that will look things up in a hurry. In fact, we should just make a class that welds a HashSet to the side of our ArrayList, because I know I've solved a similar problem before and we may as well not have to *keep* solving it."
I then paused and ran a brief search.
Right. ListOrderedSet in Apache Commons. I figured someone else had had this problem before...
Did I mention how nice it is to be working in a language with modern libraries available?