| Constructor and Description |
|---|
LazySequence(SequenceIterator<T> iterator)
Create a virtual sequence backed by an iterator
|
| Modifier and Type | Method and Description |
|---|---|
T |
head()
Get the first item in the sequence.
|
SequenceIterator<T> |
iterate()
Iterate over all the items in the sequence.
|
Sequence<T> |
makeRepeatable()
Ensure that the sequence is in a form where it can be evaluated more than once.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasIterable, materializepublic LazySequence(SequenceIterator<T> iterator)
iterator - the iterator that delivers the items in the sequencepublic T head() throws XPathException
head in interface Sequence<T extends Item<?>>XPathException - if an error occurs evaluating the underlying expressionpublic SequenceIterator<T> iterate() throws XPathException
iterate in interface Sequence<T extends Item<?>>XPathException - if evaluation of the iterator fails.java.lang.IllegalStateException - if iterate() has already been calledpublic Sequence<T> makeRepeatable() throws XPathException
SequenceLazySequence and Closure can only be evaluated
once, and this operation causes these to be grounded. However, making it repeatable
is not the same as making it grounded; it does not flush out all errors. Indeed, lazy
evaluation relies on this property, because an expression that has been lifted out of
a loop must not be evaluated unless the loop is executed at least once, to prevent spurious
errors.makeRepeatable in interface Sequence<T extends Item<?>>XPathException - if evaluation failsCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.