Comp 271 lab 1 - ArrayList<String>



In this lab you will use ArrayLists; in fact, you will use an ArrayList of ArrayLists. This lab can also be seen as a preparation for hashing.

Step 1 Instructions:

Step 2: Now try increasing HMax to 500, or 1000. Do you see any empty lines in the output?

Step 3: The file words.text contains one word that is duplicated. Find it, by checking, before adding each word, whether that word is already present:

L = HArray.get(hc);
if (L.contains(w)) System.err.format(...);

A starter BlueJ project, in .zip format, is available here. The starter file includes code to open the file. Each call to br.readLine() returns one word of the file.

Submit your work on Sakai (or via email) by putting it all into a zip file (that is, make a zip file of your BlueJ project directory). I think that all goes ok if you do this with Java. (For C#, there would be an included .exe file, which the email system declines to forward.)