void prepareForChildren(int parentId, int childrenCount) {
      assert parentId == size() - 1;
      if (childrenCount == 0) return;

      if (myCurrentParent >= 0) {
        int currentCount = getChildrenCount(myCurrentParent);
        switchChildrenToJoinedList(myCurrentParent, currentCount, myExpectedChildrenCount - currentCount);
      }

      myCurrentParent = parentId;
      myExpectedChildrenCount = childrenCount;
    }
void prepareForChildren(int parentId, int childrenCount)