Witscale Test Center

SCJP Objectives covered


SCJP Objectives covered

Section 9: The Collections Framework

 

9.1 Make appropriate selection of collection classes/interfaces to suit specified behavior requirements.

 

9.2 Distinguish between correct and incorrect implementations of hashcode methods.

 

 

 

We have already seen one type of collection that is built-in the Java language, the arrays. In addition, Java provides you with a various types of collections that suit a specific need. For instance, if you want to retrieve the objects in collection in sorted fashion, Java provides you with the sorted collections. Earlier versions of Java had very few collection classes (namely Hashtable and Vector). JDK1.2 first introduced the first complete collections framework that contained various collection structures such as lists, sets, and maps. Thus it fulfils most of the generic requirements for storing a group of objects.  You can choose the collection that is most appropriate for your requirement. Since these collections are well tested, you are likely to get reasonable performance. In addition, you are spared to write you own collection class implementing complex algorithms for storing, searching sorting etc. If you have a specific need that is not properly implemented by collection classes, you can create a customized solution by implementing the standard interfaces defined in the Collections Framework. This way your code can maintain the compatibility with other Java code.