code: public static void visitDescendants(Component component, Predicate<Component> handler) {
  
          List<Component> stack = Lists.newArrayList();
          stack.add(component);
          while (!stack.isEmpty()) {
              Component currentComponent = stack.get(stack.size() - 1);
              stack.remove(stack.size() - 1);
              if (!handler.apply(currentComponent)) {
                  return;
              }
              if (currentComponent instanceof HasComponents) {
                  List<Component> children = Lists.newArrayList((HasComponents)currentComponent);
                  Collections.reverse(children);
                  stack.addAll(children);
              }
          }
      }
docs: Visits all descendants of a given component (including the component itself) and applies a predicate
  to each.<p>
  
  If the predicate returns false for a component, no further descendants will be processed.<p>
  
  @param component the component
  @param handler the predicate