in src/main/java/org/apache/sling/discovery/impl/TopologyWebConsolePlugin.java [739:768]
private StringBuilder diff(final Map<String, String> oldProps,
final Map<String, String> newProps) {
final Set<String> oldKeys = new HashSet<String>(oldProps.keySet());
final Set<String> newKeys = new HashSet<String>(newProps.keySet());
StringBuilder sb = new StringBuilder();
for (Iterator<String> it = oldKeys.iterator(); it.hasNext();) {
String oldKey = it.next();
if (newKeys.contains(oldKey)) {
if (oldProps.get(oldKey).equals(newProps.get(oldKey))) {
// perfect
} else {
sb.append("(" + oldKey + " changed from "
+ oldProps.get(oldKey) + " to "
+ newProps.get(oldKey) + ")");
}
newKeys.remove(oldKey);
} else {
sb.append("(" + oldKey + " was removed)");
}
it.remove();
}
for (Iterator<String> it = newKeys.iterator(); it.hasNext();) {
String newKey = it.next();
sb.append("(" + newKey + " was added)");
}
return sb;
}