I’m in the position of extending LinkedList and implement Set, so that I have a list with no duplicates. I’m wondering if such an implementation doesn’t exist already?
All I’m planning to do is to override the add(e) method to first look-up the element, and if present don’t add it. Something like:
add(E){
if(get(E) == null) super.add(E);
}
No Java implementation exists in the standard collections.
However, you can take a look at SetUniqueList from the Common Collections which may be along the lines of what you are looking for.