private static int compareStubPositions(StubElement<?> stub1, StubElement<?> stub2) {
    int depth1 = getStubDepth(stub1);
    int depth2 = getStubDepth(stub2);
    int diff = Integer.compare(depth1, depth2);
    while (depth1 > depth2) {
      stub1 = stub1.getParentStub();
      depth1--;
    }
    while (depth2 > depth1) {
      stub2 = stub2.getParentStub();
      depth2--;
    }
    int cmp = compareBalancedStubs(stub1, stub2);
    return cmp == 0 ? diff : cmp;
  }
private static int compareStubPositions(StubElement<?> stub1, StubElement<?> stub2)