It is known as collection framework because some classes and interfaces are introduced from java2 to manage the collection. Before the collection framework you can use array to manage the collection.
If you are managing the collection with array ten you may get following limitations
* The array is static. It means the size of the array cannot be changed dynamically.
* If you want to insert the element between the array or if you want to delete the element from the middle of the array then it will be time taking process. If you want to implement then you need to implement explicitly.
* At the time of creating the array you need to specify the type of the element that will be stored in the array. etc.,
To solve these problems Sun micro systems has provided some legacy classes and interfaces to manage the collection. Following are the legacy classes available in java.
* Vector
* Stack
* Hashtable
* Properties and
* Dictionary
* Enumeration is the Interface.
By using these classes you can collect following types of element
1. The simple element
2. The element with key and value format
Vector and Stack will be used to collect and to manage simple elements. Hashtable, Properties and Dictionary will be used to manage the element of key and value format.
Enumeration interface is used to access the information stored by using legacy classes. The problem with legacy classes is there is no specific difference where you can use the corresponding class. Almost all the methods available in the legacy classes are synchronized. Because of this one object cannot be accessed by multiple threads concurrently. To solve these problems Sun micro system has introduced some classes and interfaces to manage the collection from java2.
The collection of classes and interfaces is known as Collection Framework. These classes and interfaces are available in java.util package. In the collection framework following are the two interfaces provided.
1. Collection
2. Map
The subclass of collection interface will be used to manage the collection of simple elements. The sub classes of Map interface will be used to manage the collection of elements of key, value format.
Collection interface has two sub interfaces
1. List
2. Set
To access the element from the collection framework sun has provided following interface.
1. Iterator
2. ListIterator
Can u post me collection interface profile
ReplyDeleteCan u post me collection interface profile
ReplyDelete