Witscale Test Center

14.1 Overview of Collection framework


14.1 Overview of Collection framework

Generically speaking, a collection is a group of objects. The objects that are stored in a collection object are called as the elements of that collection.  Usually all collection objects provide following basic functionality. You can…

1.       Add objects to the collection.

2.       Remove objects from the collection.

3.       Search an object in the collection.

4.       Retrieve an object from the collection (without removing it).

5.       Iterate through the collection, looking at each element (object) one after another (to do some operation on each one of them).

 

Beside this basic functionality, some collections have specialized roles. The collection framework is made up of several such classes as well as standard interfaces. Let us divide this framework in three main parts for sake of simplicity as:

 

1.       Six core interfaces

2.       Classes implementing the core interfaces.

3.       Utility classes with lots of static utility methods

 


Figure 14.1 shows the collection framework with these three main parts. The entire collection framework lies in the package java.util.

 

Figure 14.1 The collection framework in java.util package with its three main parts

 

Note that only prominent classes and interfaces are shown in the figure. There are other classes in the collection framework. But we will learn about only about the most prominent ones in this chapter. Also note that java.util package has other useful classes which are not part of collection framework such as Date, Calendar etc. But we will not study them.

 

Though the SCJP objective 9.1 does not explicitly specify, there is one hidden objective. You must know have a basic knowledge of important collection classes and interfaces. The exam has questions which require fairly basic knowledge of these classes. For instance, you should know which class to choose based on a stated requirement in question. Remember, you need not have a detailed knowledge of the API of each class. All you need is the purpose of all prominent classes and interfaces.