PDA

View Full Version : Difference between collection and arraylist.



saneha
04-24-2011, 07:10 PM
Assalam O Alaikum Sir, Please explain the difference of collection and arraylist as both can add any type of object

Vuhelper
04-24-2011, 07:11 PM
The Collections API is a set of classes and interfaces that support operations on collections of objects.
Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
Example of interfaces: Collection, Set, List and Map.
Whereas,
ArrayList: It is re-sizable array implementation. Belongs to 'List' group in collection. It permits all elements, including null. It is not thread -safe.

Collections: It implements Polymorphic algorithms which operate on collections.

Collection: It is the root interface in the collection hierarchy.