Parametric Data Types
The Java Collections Framework
Understanding the Array  List data structure
Mutating Array  List

Lab 7b

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.

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 Lab7b and import into it the files saved in

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, 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.