1 Lab Objectives
2 Problem Setup
3 Reminders on Using Java’s built-in Lists
4 Practice with Lists and Hash Maps
5 Javadoc
6 What to Turn in

Lab 5

1 Lab Objectives

2 Problem Setup

Many websites recommend books and movies based on combinations of items that other people have liked. For example, if Sue likes "Avatar" and "Driving Miss Daisy" and Joe likes "Avatar", the system might recommend that Joe watch "Driving Miss Daisy". This week, we use this problem as a foundation for practicing with hashtables, lists, and Javadoc (Java’s documentation system).

Our goal is to create a recommendation system that contains a mapping from users to lists of items that they like. You might want to think about how you would design this before seeing the detailed problems below.

3 Reminders on Using Java’s built-in Lists

If you want to use the LinkedList classes, you first need the following statement at the top of your file:

  import java.util.LinkedList;

The following code fragment shows how to create a list with two elements:

  LinkedList<Integer> newlist = new LinkedList<Integer>();

  newlist.add(3);

  newlist.add(6);

You cannot write newlist.add(3).add(6) because the add operator in Java does not return the list (it returns void instead).

The Java documentation for lists will help you locate other list operations that you might need for this lab.

4 Practice with Lists and HashMaps

These problems work through information that we will assume you know in the rest of the course. Even if you have to work briefly at home to finish these up, please do so as they will affect future lectures or assignment requirements.

5 Javadoc

Now, we want to add documentation to this system. Java has a built-in documentation system called Javadoc that produces documentation in html. Both DrJava and Eclipse have options for generating Javadoc output automatically (in DrJava, go to the Tools menu, then Javadoc; in Eclipse, go to "Generate Javadoc" under the Project menu). Run Javadoc documentation generation on your Recommender class. Explore the output: what has Javadoc detected automatically about your class hierarchy?

Your generated documentation is missing some important details, like descriptions (purpose statements) of the methods. Javadoc has an annotation language, with which you add such details to fields and methods through stylized comments. See this tutorial on Javadoc. Use it to add your name to your file and purpose statements to each method.

6 What to Turn in

Submit all .java files that you produced for this assignment to the Lab5 area via Turnin.