}
static Map<NetworkInterface, Set<InetAddress>> pruneAliasDuplicates(Map<NetworkInterface, Set<InetAddress>> result) {
final Map<NetworkInterface, Set<InetAddress>> pruned = new HashMap<NetworkInterface, Set<InetAddress>>();
for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : result.entrySet()) {
NetworkInterface ni = entry.getKey();
if (ni.getParent() != null) {
pruned.put(ni, entry.getValue());
} else {
Set<InetAddress> retained = new HashSet<InetAddress>(entry.getValue());
Enumeration<NetworkInterface> subInterfaces = ni.getSubInterfaces();
while (subInterfaces.hasMoreElements()) {
NetworkInterface sub = subInterfaces.nextElement();
Set<InetAddress> subAddresses = result.get(sub);
if (subAddresses != null) {
retained.removeAll(subAddresses);
}
}