StreamTokenizer Iterator Adapter help
Posted
by alpdog14
on Stack Overflow
See other posts from Stack Overflow
or by alpdog14
Published on 2010-03-26T15:14:38Z
Indexed on
2010/03/26
17:33 UTC
Read the original article
Hit count: 217
I have this StreamTokenizer Iterator Adapter that is suppose to create a Tokenizer Iterator Index Builder then build the index from a STIA wrapped around a StreamTokenizer. I am having trouble implementing the hasNext and Next for my STIA, can anyone help me, here is my class:
public class StreamTokenizerIteratorAdapter implements Iterator<Token> {
DefaultIndexImpl index;
StreamTokenizer source;
public StreamTokenizerIteratorAdapter(final StreamTokenizer source) {
if (source == null)
throw new IllegalArgumentException("source == null");
}
@Override
public boolean hasNext() {
return !index.isEmpty();
}
public Token next() {
if(!index.isEmpty())
return next();
else
return null;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
Should I be using the source element in the hasNext() and next()?
© Stack Overflow or respective owner