Unformatted text preview:

Download this zip file and import it into Eclipse as a project https www cs umd edu fpe 132 Lab07 zip You will be implementing the Iterator for a class called StringFilter which implements the Iterable String interface The StringFilter class has two instance variables ArrayList String list int lengthToKeep 1 First for practice implement the class StringFilterIterator so that the iterator goes through and provides via calls to next all of the Strings in the list The variable called lengthToKeep is not being used at this point You must implement all three methods of the Iterator interface next hasNext and remove 2 This is much harder Try to re code your implementation so that your iterator will provide via next only those Strings in the list whose length is equal to the value of lengthToKeep For example if the list is hi there what are you doing today and the lengthToKeep is 3 then the Iterator should provide via next the Strings are you If the lengthToKeep is changed to 5 then the Iterator should provide via next the Strings there doing today You may assume that the value of the variable lengthToKeep will not change while the Iterator is in the midst of iterating over the list 3 Run Driver1 to see if your implementation is working If your remove isn t working be sure to write the iterator in such a way that it doesn t modify the original list and also doesn t copy any portion of the original list to another data structure 4 If you have time try running Driver2 which will display all words of a specified length that are found in the play Romeo and Juliet


View Full Document

UMD CMSC 131 - Lab 07 Handout

Documents in this Course
Set #3

Set #3

7 pages

Exam #1

Exam #1

6 pages

Exam #1

Exam #1

6 pages

Notes

Notes

124 pages

Notes

Notes

124 pages

Load more
Download Lab 07 Handout
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 07 Handout and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 07 Handout and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?