public interface WordFinder
An interface for iterates through the words.
When the object is instantiated, and before the first call to next()
is made, the following methods should throw a
WordNotFoundException:
current(),startsSentence() and
replace().
A call to next() when hasMoreWords() returns
false should throw a WordNotFoundException.
| Modifier and Type | Method and Description |
|---|---|
Word |
current()
This method should return the Word object representing the current word in
the iteration.
|
boolean |
hasNext()
Tests the finder to see if any more words are available.
|
Word |
next()
This method should return the Word object representing the next word in the
iteration (the first word if next() has not yet been called.)
|
void |
replace(String newWord)
This method should replace the current Word object with a new string
|
Word current()
WordNotFoundException - current word has not yet been set.boolean hasNext()
Word next()
WordNotFoundException - search string contains no more words.void replace(String newWord)
newWord - the word to replace the current word with.WordNotFoundException - current word has not yet been set.Copyright © 2020. All rights reserved.