int removeLeaf(@NotNull VirtualFilePointerImpl pointer) {
    Object leaves = this.leaves;
    if (leaves == null) {
      return 0;
    }
    if (leaves instanceof VirtualFilePointerImpl) {
      if (leaves == pointer) {
        this.leaves = null;
        return 0;
      }
      return 1;
    }
    VirtualFilePointerImpl[] newLeaves = ArrayUtil.remove((VirtualFilePointerImpl[])leaves, pointer);
    if (newLeaves.length == 0) newLeaves = null;
    this.leaves = newLeaves;
    return newLeaves == null ? 0 : newLeaves.length;
  }
int removeLeaf(@NotNull VirtualFilePointerImpl pointer)