/** Returns true iff child is a descendant of parent, or if child is equal to parent. */ public static <T> boolean isDescendantOfOrEqualTo(TreeDef.Parented<T> treeDef, T child, T parent) { requireNonNull(treeDef); requireNonNull(parent); if (child.equals(parent)) { return true; } else { return isDescendantOf(treeDef, child, parent); } }