void () { Set<RemoteServer<?>> servers = new HashSet<>(); for (NamedConfigurable<RemoteServer<?>> configurable : getConfiguredServers()) { servers.add(configurable.getEditableObject()); } List<RemoteServer<?>> toDelete = new ArrayList<>(); for (RemoteServer<?> server : getServers()) { if (!servers.contains(server)) { toDelete.add(server); } } for (RemoteServer<?> server : toDelete) { myServersManager.removeServer(server); } }