The Set Interface : java collection interface that guarantees no duplicates as well as preservation of insertion order
The Java platform contains three general purpose Set implementations: HashSet , TreeSet , and LinkedHashSet . HashSet , which stores its elements in a hash table, is the best-performing implementation; however it makes no guarantees concerning the order of iteration. TreeSet , which stores its elements in a red-black tree, orders its elements based on their values; it is substantially slower than HashSet . LinkedHashSet , which is implemented as a hash table with a linked list running through it, orders its elements based on the order in which they were inserted into the set (insertion-order). LinkedHashSet spares its clients from the unspecified, generally chaotic ordering provided by HashSet at a cost that is only slightly higher. You could try to build it by combining Set and List . Any collection implementing Set should not allow duplicate elements, and any collection implementing List should maintain order.