KJW
KJW

Reputation: 15251

Java: What data structure to use with predictable ordering, no duplicates and maintains it's own integer index?

I need to maintain column names, and not allow duplicate entries, while maintaining the order of these column names with associated index of it's own.

Down the road I need to swap column name at an index, and also add more column names to the end or beginning.

LinkedHashSet<E> seems like an ideal candidate, are there any others?

Need to support Synchronization

Upvotes: 0

Views: 266

Answers (1)

Bozho
Bozho

Reputation: 597016

commons-collections has SetUniqueList - it is a List that guarantees uniqueness.

Upvotes: 1

Related Questions