Is there a list type in java that stores objects in ascending order and not adds if this object is previously added. I know java maps can do that but I wonder if there is a list type that does what I want. Otherwise I have to override contains, equalsTo and add methods,right?
So you need a list containing only unique elements? Two options:
java.util.LinkedHashSet
- preserves the order of insertion, has the set semanticsSetUniqueList
- allows list operations like get(..)
and set(..)
ListOrderedSet
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With