Sho SHIMIZU
Committed by Brian O'Connor

Remove unnecessary empty set check

It isn't harmful to remove the if statement because missing.forEach()
doesn't call the specified lambda when it is empty.

Change-Id: I3f43f5fd4a4422899c621f2a63c0259f1bae838a
...@@ -455,12 +455,10 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider { ...@@ -455,12 +455,10 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
455 .filter(cp -> !existing.contains(cp)) 455 .filter(cp -> !existing.contains(cp))
456 .collect(Collectors.toSet()); 456 .collect(Collectors.toSet());
457 457
458 - if (!missing.isEmpty()) { 458 + List<PortDescription> newPorts = Lists.newArrayList();
459 - List<PortDescription> newPorts = Lists.newArrayList(); 459 + ports.forEach(p -> newPorts.add(description(p)));
460 - ports.forEach(p -> newPorts.add(description(p))); 460 + missing.forEach(cp -> newPorts.add(description(cp)));
461 - missing.forEach(cp -> newPorts.add(description(cp))); 461 + deviceProviderService.updatePorts(device.id(), newPorts);
462 - deviceProviderService.updatePorts(device.id(), newPorts);
463 - }
464 } 462 }
465 463
466 // Creates a port description from the specified port. 464 // Creates a port description from the specified port.
......