Types of Collection Framework
Types of Collection Framework
In the initial version of java the concept of Collection Framework was known as data structures. At that time this concept is unable to full fill all requirement of java application so sun micro-system add some new classes and interfaces in collection framework. Here i will show you old (Legacy Collection Framework) and new (New Collection Framework) both collection framework. Collection Framework are mainly divide in two types they are;
- Legacy Collection Framework
- New Collection Framework
Legacy Collection Framework
Legacy Collection Framework classes and interfaces are Synchronized and for retrieving data from Legacy Collection Framework we use Enumeration. Classes and interfaces are;
- Stack
- Vector
- Directory
- HashTable
- Properties
- Enumeration
Note: Legacy Collection Framework are Synchronized because of this we can not use Legacy Collection Framework for web based applications.
New Collection Framework
New Collection Framework classes and interfaces are non-Synchronized and for retrieving data from new Collection Framework you can use foreach loop, iterator, listiterator. Classes and interfaces are;
- ArrayList
- LinkedList
- HashSet
- TreeSet
- HashMap
- TreeMap
Note: All new Collection Framework are not Synchronized.