public abstract class AbstractTokenizer<T> extends Object implements Tokenizer<T>
getNext()
method. This implementation does not
allow null tokens, since
null is used in the protected nextToken field to signify that no more
tokens are available.Constructor and Description |
---|
AbstractTokenizer() |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
getNext()
Internally fetches the next token.
|
boolean |
hasNext()
Returns
true if this Tokenizer has more elements. |
T |
next()
Returns the next token from this Tokenizer.
|
T |
peek()
This is an optional operation, by default supported.
|
void |
remove()
This is an optional operation, by default not supported.
|
List<T> |
tokenize()
Returns text as a List of tokens.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected T nextToken
protected abstract T getNext()
public T next()
public boolean hasNext()
true
if this Tokenizer has more elements.public void remove()
public T peek()
peek
in interface Tokenizer<T>
NoSuchElementException
- if the token stream has no more tokens.