Collections_Intro1.htm
Java Collections is an object holding  set of classes and interfaces. Java provides ready to use collection classes. The classes and interfaces of the collection frame work are the members of  java.util1 package. Java also has a set of concurrent collections in the java.util.concurrent package.

In C++ STL ("Standard Template Library ") offers a set of container constructs, to hold composite data. These constructs are Container, Iterators, Function Objects (functors), and algorithms.

  • Container : stores construct able and assignable objects
    • Sequence:
    • LIST :  adds data as First Come Last To Go, at the bottom of storage pile. May contain duplicate data. Must be instantiated prior to use.
      List   list1 = new ArrayList();
      List   list2 = new LinkedList();
      List  list3 = new Vector();
      List  list4= new Stack(); 
    • Queue : FIFO  add elements at the last Similar to List with additional operation like insertion, removal, and  inspection.

 

Java Collections API has two groups of interfaces : Collections and MAP
FYI : Collections :
  • Interface Collection is the root interface
  • List, Set and Queue derive from collection
    • Set is a collection, does not contain duplicates
    • Queue : waiting data, inserted at the last and deleted from the top (First come last to go)
    • List is an ordered sequences, can contain duplicate values. List index is zero based.
      • Class ArrayList and Vector are dynamic and resizable arrays.
        • Vectors are synchronized, executes slower that ArrayList as it uses an overhead of thread synchronization.
        • ArrayList are not synchronized, executes faster than vector
      • LinkedList can be used to create stacks, queues and deques (double ended queues)
  • MAP : A collection that provides handle to "valuset" with a "keyset".