Hello,
does exist in Java a structure like a Vector<String> (or similar) that do two things:
- is automatically sorted when an element is added (I need by string)
- avoid to insert duplicates
thanks,
Hello,
does exist in Java a structure like a Vector<String> (or similar) that do two things:
- is automatically sorted when an element is added (I need by string)
- avoid to insert duplicates
thanks,
Regards
Vector and automatically sorted are somewhat contradictive goals.
Have a look at Set and HashSet.
HTH
TreeSet is sorted and does not allow duplicates.
Bookmarks