int (int level, DiffTreeChangeBuilder<? super OT, ? super NT> consumer, int oldChildrenLimit, OT[] oldChildren, int oldIndex, int newChildrenLimit, NT[] newChildren, int newIndex) { int len = 0; while (oldIndex < oldChildrenLimit - len && newIndex < newChildrenLimit - len) { OT oldLastChild = oldChildren[oldChildrenLimit - len - 1]; NT newLastChild = newChildren[newChildrenLimit - len - 1]; CompareResult c = looksEqual(oldLastChild, newLastChild); if (c == CompareResult.NOT_EQUAL) break; if (c == CompareResult.DRILL_DOWN_NEEDED) { build(oldLastChild, newLastChild, level + 1, consumer); } else if (c == CompareResult.TYPE_ONLY) { consumer.nodeReplaced(oldLastChild, newLastChild); } len++; } return len; }