void () { final List<DirDiffElementImpl> selectedElements = getSelectedElements(); myUpdating.set(true); myElements.removeIf(element -> switch (element.getType()) { case SOURCE -> !mySettings.showNewOnSource; case TARGET -> !mySettings.showNewOnTarget; case SEPARATOR, ERROR -> false; case CHANGED -> !mySettings.showDifferent; case EQUAL -> !mySettings.showEqual; }); boolean sep = true; for (int j = myElements.size() - 1; j >= 0; j--) { if (myElements.get(j).isSeparator()) { if (sep) { myElements.remove(j); } else { sep = true; } } else { sep = false; } } fireTableDataChanged(); myUpdating.set(false); int index; if (!selectedElements.isEmpty() && (index = myElements.indexOf(selectedElements.get(0))) != -1) { myTable.getSelectionModel().setSelectionInterval(index, index); TableUtil.scrollSelectionToVisible(myTable); } else { selectFirstRow(); } myPanel.update(true); }