algs.model.search
Class StringFileIterator
java.lang.Object
algs.model.search.StringFileIterator
- All Implemented Interfaces:
- java.util.Iterator<java.lang.String>
public class StringFileIterator
- extends java.lang.Object
- implements java.util.Iterator<java.lang.String>
Return an Iterator for the strings in a File.
Useful to populate a Hashtable with initial values.
- Since:
- 1.0
- Version:
- 1.0, 6/15/08
- Author:
- George Heineman, Gary Pollice
Constructor Summary |
StringFileIterator(java.io.File f)
On constructor set up the Scanner, if possible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringFileIterator
public StringFileIterator(java.io.File f)
- On constructor set up the Scanner, if possible.
- Parameters:
f
- File from which to read strings, one per line.
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator<java.lang.String>
next
public java.lang.String next()
throws java.util.NoSuchElementException
- Specified by:
next
in interface java.util.Iterator<java.lang.String>
- Throws:
java.util.NoSuchElementException
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator<java.lang.String>
This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.