/** * Get the contents of this value in the form of a Java {@link java.lang.Iterable}, * so that it can be used in a for-each expression. In the general case, obtaining * the iterable may raise dynamic errors; but the {@link java.util.Iterator} obtained * from the iterable will be error-free. Subclasses of {@link Sequence} that * implement {@link GroundedValue} are directly iterable, so this method is a no-op * in those cases. * * @return an Iterable containing the same sequence of items */ default Iterable<T> asIterable() throws XPathException { return iterate().materialize().asIterable(); }
/** * Get the contents of this value in the form of a Java {@link java.lang.Iterable}, * so that it can be used in a for-each expression. In the general case, obtaining * the iterable may raise dynamic errors; but the {@link java.util.Iterator} obtained * from the iterable will be error-free. Subclasses of {@link Sequence} that * implement {@link GroundedValue} are directly iterable, so this method is a no-op * in those cases. * * @return an Iterable containing the same sequence of items */ default Iterable<T> asIterable() throws XPathException { return iterate().materialize().asIterable(); }