Interface FocusIterator

All Superinterfaces:
AutoCloseable, Closeable, SequenceIterator
All Known Implementing Classes:
ArrayIterator, ArrayIterator.Of, ArrayIterator.OfNodes, FocusTrackingIterator, ListIterator, ListIterator.Of, ListIterator.OfAtomic, ManualGroupIterator, ManualIterator, ManualRegexIterator, MultithreadedFocusTrackingIterator, NodeListIterator, ReportingSingletonIterator, SingleAtomicIterator, SingletonIterator

public interface FocusIterator extends SequenceIterator
An iterator that maintains the values of position() and current(), typically implemented as a wrapper over an iterator which does not maintain these values itself.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the current value in the sequence (the one returned by the most recent call on next()).
    int
    Get the position of the last item in the sequence
    int
    Get the current position.

    Methods inherited from interface net.sf.saxon.om.SequenceIterator

    close, next
  • Method Details

    • current

      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.
      Returns:
      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.
      Since:
      8.4
    • position

      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.

      Returns:
      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.
      Since:
      8.4
    • getLength

      int getLength() throws XPathException
      Get the position of the last item in the sequence
      Returns:
      the position of the last item
      Throws:
      XPathException - if a failure occurs reading the sequence