boolean (@NotNull NodeIterator nodes, @NotNull NodeIterator nodes2) { while (true) { if (!nodes.hasNext() || !nodes2.hasNext()) { return !nodes.hasNext() && !nodes2.hasNext(); } skipIfNecessary(nodes, nodes2); skipIfNecessary(nodes2, nodes); if (!nodes.hasNext() || !nodes2.hasNext()) { return !nodes.hasNext() && !nodes2.hasNext(); } if (!match(nodes.current(), nodes2.current())) { return false; } nodes.advance(); nodes2.advance(); } }