if (!Sequence.Tree.isDescendant(basePath, affectedPath)) {
// All paths from here forward are guaranteed to be unaffected
break;
}
Integer[] elements = affectedPath.toArray();
elements[depth]++;
paths.update(i, new ImmutablePath(elements));
}
} finally {
// Restore the comparator