private void mergeAcceptedNodes(@NotNull N node, List<? extends U> accepted) {
      int k = 0;
      N cur = getChildSafe(node, 0);
      IntList newIds = new IntArrayList();
      for (U child : accepted) {
        U curUsrObject = getUserObject(cur);
        boolean isCur = cur != null && equalUserObjects(child, curUsrObject);
        if (isCur) {
          cur = getChildSafe(node, k + 1);
        }
        else {
          newIds.add(k);
          node.insert(getNode(child), k);
        }
        ++k;
      }
      if (!newIds.isEmpty()) {
        nodesWereInserted(node, newIds.toIntArray());
      }
      if (node.getChildCount() > k) {
        IntList leftIds = new IntArrayList();
        List<N> leftNodes = new ArrayList<>();
        for (int i = node.getChildCount() - 1; i >= k; --i) {
          leftNodes.add(getChild(node, i));
          node.remove(i);
          leftIds.add(i);
        }
        if (!leftIds.isEmpty()) {
          int[] ints = leftIds.toIntArray();
          for (int i = 0; i < ints.length; i++) {
            int temp = ints[i];
            ints[i] = ints[ints.length - i - 1];
            ints[ints.length - i - 1] = temp;
          }
          Collections.reverse(leftNodes);
          nodesWereRemoved(node, ints, leftNodes.toArray());
        }
      }
    }
private void mergeAcceptedNodes(@NotNull N node, List<? extends U> accepted)