Wednesday, December 23, 2009

Collections in java

Collection:

It is an object that groups multiple elements on a single unit. It is used to store,

retrive, manipulate and communicate the data.

List :

It care about index. ordered based on the index . we can specify the index of elements or it stored default by end .

ArrayList:

Its a growable array. Fast Iteration and Random Access.

Vector:

Synchronized ArrayList . Random access.

Linked List:

Like Array list ordered by index position and also doubly linked.

Fast Insertion and Deletion.


SET:

Its care about uniqueness-its does not allow duplicate.

Hashset:

un ordered and un sorted . Efficient implementation of hasCode() . While iterate we can't predict this order.

LinkedHashSet:

ordered Hashset. Doubly linked. While iterate we can get which order we r inserted.

TreeSet:

Sorted set . sorted by natutral order.

Map:

Its care about unique identifiers. U map a unique id to a specific value, where key and value both r objects.

HashMap:

Un ordered and un sorted. One null key and multiple null values allowed.

Hashtable:

Synchronized HashMap. No null key/values allowed.

LinkedHashMap:

Ordered hashmap by insertion.doubly linked.

TreeMap:

Sorted Map.


No comments:

Post a Comment