int (@NotNull ShowUsagesTable.MyModel tableModel, @NotNull List<? extends UsageNode> listOld, @NotNull List<? extends UsageNode> listNew, int oldSelection) { UsageNode[] oa = listOld.toArray(new UsageNode[0]); UsageNode[] na = listNew.toArray(new UsageNode[0]); List<ModelDiff.Cmd> cmds = ModelDiff.createDiffCmds(tableModel, oa, na); int selection = oldSelection; if (cmds != null) { for (ModelDiff.Cmd cmd : cmds) { selection = cmd.translateSelection(selection); cmd.apply(); } } return selection; }