Parametric Data Types
The Java Collections Framework
Understanding the Array List data structure
Mutating Array List
Generating Javadocs
Version: 5.3.0.10

Lab 8

Goals: The goals of this lab is to learn how to work with parametric data types.

In the second part of this lab we will learn how to work with mutable direct access data types defined in the Java Collections Framework library.

We will also iintroduce the Javadoc style of comments for java programs that are designed to generate searchable documentation for Java programs.

Parametric Data Types

In the previous exercise we have defined two lists of items, but the only difference between them was the type of data the list contained.

In this part of the lab we will abstract over the data type the lists contain.

Start with a new project Lab8 and import into it the files saved in Lab8.zip.

You should have the following files, where the ILo file contains a parametrized definition of a list of items of the type given by the parameter T:

The Java Collections Framework

Start this part of the lab by looking at the web pages for the Java Libraries APIs. Scroll through the All Classes in the lower left frame to find the Comparable and Comparator interfaces. You can see from the descriptions that there is a lot of detail, much more than we would expect from such a simple function-object. We will address some of these issues in the lectures.

Scroll through the All Classes frame on the left again and find the ArrayList class. In lecture we have discussed a number of methods we can use to modify/manipulate and instance of ArrayList. Use the online documentation as you work on this part of the lab.

Understanding the ArrayList data structure

For this part of the lab download the file ExamplesArrayList.java, and add it to your project. It contains one classthe ExamplesArrayList class that has some code designed to show how to work with ArrayList data structure.

Your goal in this part of the lab is to extend the provided test suite for the methods defined for the Arraylist.

Mutating ArrayList

Continue with the current project and the test suite in the class ExamplesArrayList.

Generating Javadocs

Spend a few minutes learning how to generate web pages of your documentation for this project. Notice that we have already started to write all purpose statements and comments using the JavaDoc format.

Adjust any comments your have added to your project to conform to the Javadoc style.

Under the Project menu select Generate Javadoc and then select the files that should be used to generate the documentation (likely your entire project). By convention we typically generate JavaDoc files into a directory named docs at the same level as the src directory.

Be sure to fix any warnings and problems with the generation.