public static UIComponent firstWithId(String id, UIComponent base) {
        if (id.equals(base.getId())) {
            return base;
        }

        UIComponent result = null;

        Iterator<UIComponent> kids = base.getFacetsAndChildren();
        while (kids.hasNext()) {
            UIComponent kid = kids.next();
            if (id.equals(kid.getId())) {
                result = kid;
                break;
            }
            result = firstWithId(id, kid);
            if (result != null) {
                break;
            }
        }
        return result;
    }
Finds the first component with the given id (NOT clientId!).
Also used by p:resolveFirstComponentWithId.

@param id The id.
@param base The base component to start the traversal.
@return The component or null.
primefaces/src/main/java/org/primefaces/util/ComponentTraversalUtils.java