Iterators / Iterables / Streams
Elemento provides several methods to iterate over node lists, child elements, or elements returned by a selector. Some methods return Iterator
, Iterable
and Stream
.
Methods returning java.util.Iterator
java.util.Iterator
Elements.iterator(JsArrayLike<E> nodes)
Returns an iterator over the given array-like. The iterator does not support theIterator.remove()
operation.Elements.iterator(Node parent)
Returns an iterator over the children ofparent
. The iterator supports theIterator.remove()
operation, which removes the current node from its parent.
Methods returning java.lang.Iterable
java.lang.Iterable
Elements.elements(JsArrayLike<E> nodes)
Returns an iterable for the nodes in the given array-like.Elements.children(elemental2.dom.Node parent)
Returns an iterable for the child nodes ofparent
.
Methods returning java.util.stream.Stream
java.util.stream.Stream
Elements.stream(JsArrayLike<E> nodes)
Returns a stream for the nodes in the given array-like.Elements.stream(elemental2.dom.Node parent)
Returns a stream for the child nodes ofparent
.
All methods are null-safe, check parent/child relationships, and are overloaded to accept an instance of IsElement<Element>
instead of Element
. See the API documentation of Elements for more details.
Last updated