Tags

List
A list keeps elements in order — this is the primary tool for storing objects for later use.

Stack
A stack pays attention to the recent element, and well for tracking state transition,status.

Set
A set prevents duplicates, and is most often used to keep track of things

Hash
Fast access to value by using key, appropriate for keeping relations.

Queue
Queue is primarily for communicating between processes
(even if those processes happen to share the same thread): one process puts objects on the Queue,
the other process consumes the objects. All Queues in the standard Java library
keep the objects in the enqueueing order except for PriorityQueue.
LinkedList implements Queue, but most of the queue implementations are for concurrency.

Collection says that they are all basically the same thing to hold objects (but behaviors are quite different).
that’s necessary to unify them under a common interface.

Iterators (in Java) can also provide a safety mechanism
(by using fail-fast iterators to more easily spot bugs) against concurrent modifications.


Reference:
http://www.artima.com/weblogs/viewpost.jsp?thread=119193

Advertisements