Class DepthFirstTreeIterator<T>

java.lang.Object
com.vaadin.browserless.internal.DepthFirstTreeIterator<T>
Type Parameters:
T - the type of the tree nodes.
All Implemented Interfaces:
Iterator<T>

public final class DepthFirstTreeIterator<T> extends Object implements Iterator<T>
Walks the child tree, depth-first: first the node, then its descendants, then its next sibling.

For internal use only. May be renamed or removed in a future release.

  • Constructor Details

    • DepthFirstTreeIterator

      public DepthFirstTreeIterator(T root, Function<? super T,? extends List<? extends T>> children)
      Creates the iterator.
      Parameters:
      root - start here.
      children - fetches children of given node.
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T>
    • walk

      public static Iterable<Component> walk(Component component)
      Walks the component child tree, depth-first: first the component, then its descendants, then its next sibling.
      Parameters:
      component - the root component.
      Returns:
      the iterable over the component and all of its descendants.