Java – Sets vs Lists

Sets are a special type of an array that’s filled with unique elements. You would normally fill a set with immutable objects, objects that are unable to change their value. Sets are also used within other Java’s Collections frameworks.

Subinterfaces of Sets
NavigableSet and SortedSet

Classes Implementing Sets
AbstractSets, ConcurrentSkipListSets, CopyOnWriteArraySets, EnumSets, HashSets, JobStateReasons, LinkedHashSets and TreeSets

More information on sets can be found within Java’s documentation.
Java SE 6 Docs – Set

Lists follow more traditional arrays but their contents are in sequence. Unlike Sets, Lists allow for duplicate values and a programmer has control over where an element can be indexed within the collection. Lists are also used within other Java’s Collections frameworks.

Classes Implementing Lists
AbstractLists, AbstractSequentialLists, ArrayLists, AttributeLists, CopyOnWriteArrayLists, LinkedLists, RoleLists, RoleUnresolvedLists, Stacks and Vectors

More information on lists can be found within Java’s documentation.
Java SE 6 Docs – List

Leave a comment