Package net.sf.saxon.s9api
Class XdmSequenceIterator<T extends XdmItem>
java.lang.Object
net.sf.saxon.s9api.XdmSequenceIterator<T>
- All Implemented Interfaces:
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()The close() method should be called to release resources if the caller wants to stop reading data before reaching the end.booleanhasNext()Returnstrueif the iteration has more elements.next()Returns the next element in the iteration.static XdmSequenceIterator<XdmAtomicValue> protected static XdmSequenceIterator<XdmNode> static XdmSequenceIterator<XdmNode> ofNodes(AxisIterator base) voidremove()Not supported on this implementation.stream()Convert this iterator to a StreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
XdmSequenceIterator
-
-
Method Details
-
ofNodes
-
ofAtomicValues
-
ofNode
-
hasNext
public boolean hasNext()Returnstrueif the iteration has more elements. (In other words, returnstrueifnextwould return an element rather than throwing an exception.) -
next
Returns the next element in the iteration. Calling this method repeatedly until thehasNext()method returns false will return each element in the underlying collection exactly once.- Specified by:
nextin interfaceIterator<T extends XdmItem>- Returns:
- the next element in the iteration.
- Throws:
NoSuchElementException- iteration has no more elements.
-
remove
public void remove()Not supported on this implementation.- Specified by:
removein interfaceIterator<T extends XdmItem>- Throws:
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:
- 9.5.1.5 (see bug 2016)
-
stream
Convert this iterator to a Stream- Returns:
- a Stream delivering the same items as this iterator
- Since:
- 9.9
-