Introduction
In this lab, you will review and create three iterators and submit the assignment through Gradescope.
Files
Download the following files:
- IteratorDriver.java (Completed)
- BackScanner.java (Completed)
- SkipScanner.java
- NGramScanner.java
- SkipScannerTest.java
- SkipScannerGenericTest.java
- NGramScannerTest.java
Part 1 - Review an Iterator
Take a few minutes to read over the file BackScanner.java
to make sure you understand
how it works. You can test it using the provided driver (IteratorDriver.java
)
Part 2 - Implement a Skip Iterator
Complete the SkipScanner.java
file following the requirements put forth
in the JavaDoc comments at the beginning of the file. You can test your
iterator with the SkipScannerTest
JUnit tests.
Part 3 - Implement a Skip Iterator with Generics
Make a copy of your working SkipScanner.java
class to a new file named
SkipScannerGeneric.java
. Change the SkipScannerGeneric
class
so that instead of accepting an array of Strings it will accept an array
containing any type of object.
Part 4 - Implement a NGram iterator
Complete the NGramScanner.java
file following the requirements put forth
in the JavaDoc comments at the beginning of the file. You can test your
iterator with the NGramScannerTest
JUnit tests.
Lab Submission
Submit the following files together in Gradescope:
- SkipScanner.java
- NGramScanner.java
- SkipScannerGeneric.java