void (final ProxyGroup newGroup, final ProxyGroup oldGroup, final boolean groupWasAdded) { final String newGroupName = newGroup.getName(); if (groupWasAdded) { myFile.addGroup(newGroupName, newGroup.getPatterns(), newGroup.getProperties()); } else { final Map<String, String> oldProperties = oldGroup.getProperties(); final Map<String, String> newProperties = newGroup.getProperties(); final Set<String> deletedProperties = new HashSet<>(); for (String oldKey : oldProperties.keySet()) { if (! newProperties.containsKey(oldKey)) { deletedProperties.add(oldKey); } } final Map<String, String> newOrModifiedProperties = new HashMap<>(); for (Map.Entry<String, String> entry : newProperties.entrySet()) { final String oldValue = oldProperties.get(entry.getKey()); if ((oldValue == null) || (! oldValue.equals(entry.getValue()))) { newOrModifiedProperties.put(entry.getKey(), entry.getValue()); } } myFile.modifyGroup(newGroupName, newGroup.getPatterns(), deletedProperties, newOrModifiedProperties, newGroup.isDefault()); } }