com.developerdan.blocklist.tools.ListDiff Maven / Gradle / Ivy
package com.developerdan.blocklist.tools;
import java.util.NavigableSet;
import java.util.TreeSet;
public class ListDiff {
private ListDiff() { }
public static String domainList(final NavigableSet before, final NavigableSet after) {
var patchBuilder = new PatchBuilder();
TreeSet allDomains = new TreeSet<>(before);
allDomains.addAll(after);
for(Domain entry : allDomains) {
if (!before.contains(entry)) {
patchBuilder.added(entry);
} else if (!after.contains(entry)) {
patchBuilder.removed(entry);
} else {
patchBuilder.noChange(entry);
}
}
return patchBuilder.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy