- All Superinterfaces:
- All Known Implementing Classes:
public interface FocusIterator extends SequenceIteratorAn iterator that maintains the values of position() and current(), typically implemented as a wrapper over an iterator which does not maintain these values itself.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
current()Get the current value in the sequence (the one returned by the most recent call on next()).
getLength()Get the position of the last item in the sequence
position()Get the current position.
Item current()Get the current value in the sequence (the one returned by the most recent call on next()). This will be null before the first call of next(). This method does not change the state of the iterator.
- the current item, the one most recently returned by a call on next(). Returns null if next() has not been called, or if the end of the sequence has been reached.
int position()Get the current position. This will usually be zero before the first call on next(), otherwise it will be the number of times that next() has been called. Once next() has returned null, the preferred action is for subsequent calls on position() to return -1, but not all existing implementations follow this practice. (In particular, the EmptyIterator is stateless, and always returns 0 as the value of position(), whether or not next() has been called.)
This method does not change the state of the iterator.
- the current position, the position of the item returned by the most recent call of next(). This is 1 after next() has been successfully called once, 2 after it has been called twice, and so on. If next() has never been called, the method returns zero. If the end of the sequence has been reached, the value returned will always be <= 0; the preferred value is -1.