public abstract class AbstractCharIterator extends Object implements CharIterator
CharIterator
interface. It allows to implement a lookahead
CharIterator
easier:findNext()
. From your constructor or initializer call
findFirst()
. findFirst()
from your constructor or your iterator will always be empty.Modifier and Type | Field and Description |
---|---|
private char |
next
The next char to iterate.
|
END_OF_ITERATOR
Constructor and Description |
---|
AbstractCharIterator()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
findFirst()
This method has to be called from the constructor of the implementing class.
|
protected abstract char |
findNext()
This method tries to find the
next element. |
boolean |
hasNext()
This method determines whether there is a
next char available or the end of this iterator has been
reached. |
char |
next()
This method returns the next character to iterate or
CharIterator.END_OF_ITERATOR if the end of this iterator has been
reached. |
protected final void findFirst()
protected abstract char findNext()
next
element.null
if done
.public boolean hasNext()
CharIterator
next
char available or the end of this iterator has been
reached.hasNext
in interface CharIterator
true
if there is at least one next
char available, or false
if the end of
this iterator has been reached and further calls of CharIterator.next()
will return CharIterator.END_OF_ITERATOR
.CharIterator.next()
,
Iterator.hasNext()
public char next()
CharIterator
CharIterator.END_OF_ITERATOR
if the end of this iterator has been
reached. If CharIterator.END_OF_ITERATOR
is returned further calls will always return CharIterator.END_OF_ITERATOR
.next
in interface CharIterator
CharIterator.END_OF_ITERATOR
if the end of this iterator has been reached.Iterator.next()
Copyright © 2001–2016 mmm-Team. All rights reserved.