Interface LookaheadIterator

All Superinterfaces:
AutoCloseable, Closeable, SequenceIterator
All Known Implementing Classes:
AdjacentTextNodeMergingIterator, ArrayIterator, ArrayIterator.Of, ArrayIterator.OfNodes, AscendingRangeIterator, AttributeIterator, BigRangeIterator, DescendingRangeIterator, EmptyIterator, FocusTrackingIterator, GroupAdjacentIterator, GroupBreakingIterator, GroupByIterator, GroupEndingIterator, GroupMatchingIterator, GroupStartingIterator, ItemCheckingIterator, ItemMappingIterator, ListIterator, ListIterator.Of, ListIterator.OfAtomic, LookaheadIteratorImpl, ManualGroupIterator, ManualIterator, ManualRegexIterator, MergeGroupingIterator, MergeIterator, MultiIndex.SelectedItemsIterator, MultithreadedFocusTrackingIterator, MultithreadedItemMappingIterator, NodeListIterator, NodeWrappingAxisIterator, ReportingSingletonIterator, SingleAtomicIterator, SingleNodeIterator, SingletonIterator, SortedGroupIterator, SortedIterator, SubsequenceIterator, TailIterator, TwoItemIterator, UnionEnumeration, UnionIterator, UntypedAtomizingIterator, ValueTailIterator, ZenoSequence.ZenoSequenceIterator

public interface LookaheadIterator extends SequenceIterator
A SequenceIterator is used to iterate over a sequence. A LookaheadIterator is one that supports a hasNext() method to determine if there are more nodes after the current node.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determine whether there are more items to come.
    boolean
    Ask whether the hasNext() method can be called.

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

    close, next
  • Method Details

    • supportsHasNext

      boolean supportsHasNext()
      Ask whether the hasNext() method can be called. This method must be called before calling hasNext(), because some iterators implement this interface, but only support look-ahead under particular circumstances (this is usually because they delegate to another iterator)
      Returns:
      true if the hasNext() method is available
    • hasNext

      boolean hasNext()
      Determine whether there are more items to come. Note that this operation is stateless and it is not necessary (or usual) to call it before calling next(). It is used only when there is an explicit need to tell if we are at the last element.

      This method must not be called unless the result of supportsHasNext() is true.

      Returns:
      true if there are more items in the sequence