Elemento
GitHubSamples
  • Get started
  • Builder API
  • Event Handlers
  • Typesafe CSS Selectors
  • Custom Elements
  • Attach and Detach Handlers
  • Iterators / Iterables / Streams
  • Manipulate the DOM Tree
  • Router
  • Flow
  • Logger
  • SVG
  • MathML
  • Samples
Powered by GitBook
On this page
  • Methods returning java.util.Iterator
  • Methods returning java.lang.Iterable
  • Methods returning java.util.stream.Stream
Edit on GitHub

Iterators / Iterables / Streams

PreviousAttach and Detach HandlersNextManipulate the DOM Tree

Last updated 1 year ago

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

  • Elements.iterator(JsArrayLike<E> nodes) Returns an iterator over the given array-like. The iterator does not support the Iterator.remove() operation.

  • Elements.iterator(Node parent) Returns an iterator over the children of parent. The iterator supports the Iterator.remove() operation, which removes the current node from its parent.

Methods returning 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 of parent.

Methods returning 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 of parent.

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 for more details.

Elements