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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s