Re: Java/J2EE interview Questions hey guys, Why do we use collections when we had traditional ways forcollection?
Before the collection framework JAVA provided ad hoc classes such as Dictionary, Vector,Stack and Properties to store and manipulate group of objects. Following are the mainreason why collection framework is more desirable than the traditional JAVA collectionobjects:-
√Traditional objects did not have the unifying theme. The way you access VECTORis different from Properties. Due to this ADHOC approach software is not easilyextendable and adaptable. One of the unifying themes in the new JAVA collection isthe iterator interface. It gives a unifying way for looping through JAVA collections.
√Ready made algorithms are one of the important features of the JAVA collection.Algorithms operate on collections and are defined as static methods within theCollections class. Thus, they are available for all collections. Each collection classneed not implement its own versions. The algorithms provide a standard means ofmanipulating collections.
√Implementation of dynamic arrays, linked lists, trees, and hash tables are done inefficient manner. In case of traditional JAVA collection you will need to code allthese implementation by yourself.
__________________ Venkat knowledge is Power |