Practicing with ArrayLists

Introduction

The goal of this lab is to practice working with ArrayLists by completing a Document class that represents a text document as an ArrayList of String objects, where each entry in the ArrayList corresponds to a single line of text.

This lab was designed as a command-line Java application, so you should consider compiling and executing in the terminal. As a reminder, you can follow the following steps to compile and execute a Java program in a Unix-style terminal:

$ cd the_directory_where_your_code_is_stored
$ javac File1.java File2.java ...
$ java File1

This example assumes that File1.java contains the main method for the application.

Resources

Useful API documents:

Files

The following files are provided:

Instructions

Download the files above and complete Document.java so that all methods conform to the Javadoc comments. Test your completed file by running the two provided application programs.

Your solution should use only enhanced for loops.

Submitting

Submit your completed version of Document.java through AutoLab. You have an unlimited number of submissions. If you have trouble with your submission, you may find it helpful to look at the JUnit submission tests: DocumentTest.java.