boolean () { List<String> oldPaths = mySettings.getCustomDictionariesPaths(); Collection<String> collection = myCustomDictionariesTableView.getItems(); if (collection.isEmpty()) { return !oldPaths.isEmpty(); } Set<String> newPaths = new HashSet<>(); for (String t : collection) { if (!defaultDictionaries.contains(t)) { newPaths.add(t); } } return oldPaths.size() != newPaths.size() || !newPaths.containsAll(oldPaths) || !oldPaths.containsAll(newPaths); }