Algorithm
Development Kit 1.0

algs.model.search
Class StringFileIterator

java.lang.Object
  extended by 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.
 
Method Summary
 boolean hasNext()
           
 java.lang.String next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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>

Algorithm Development Kit 1.0

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.