Class XdmSequenceIterator<T extends XdmItem>

  • All Implemented Interfaces:

    public class XdmSequenceIterator<T extends XdmItem>
    extends java.lang.Object
    implements java.util.Iterator<T>
    An iterator over an XPath sequence.

    This class implements the standard Java Iterator interface.

    Because the Iterator interface does not define any checked exceptions, the hasNext() method of this iterator throws an unchecked exception if a dynamic error occurs while evaluating the expression. Applications wishing to control error handling should take care to catch this exception.

    • Method Detail

      • hasNext

        public boolean hasNext()
        Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
        Specified by:
        hasNext in interface java.util.Iterator<T extends XdmItem>
        true if the iterator has more elements.
      • next

        public T next()
        Returns the next element in the iteration. Calling this method repeatedly until the hasNext() method returns false will return each element in the underlying collection exactly once.
        Specified by:
        next in interface java.util.Iterator<T extends XdmItem>
        the next element in the iteration.
        java.util.NoSuchElementException - iteration has no more elements.
      • remove

        public void remove()
        Not supported on this implementation.
        Specified by:
        remove in interface java.util.Iterator<T extends XdmItem>
        java.lang.UnsupportedOperationException - always
      • close

        public void close()
        The close() method should be called to release resources if the caller wants to stop reading data before reaching the end. This is particularly relevant if the query uses saxon:stream() to read its input, since there will then be another thread supplying data, which will be left in suspended animation if no-one is consuming the data.
        Since: (see bug 2016)
      • stream

        public XdmStream<T> stream()
        Convert this iterator to a Stream
        a Stream delivering the same items as this iterator