Yuta HIGUCHI
Committed by Gerrit Code Review

GossipStores: iterate using forEach

Change-Id: I1c230932ab1c9112692708a4d5c869eac3c50db8
......@@ -1032,12 +1032,9 @@ public class GossipDeviceStore
Map<PortFragmentId, Timestamp> adPorts = new HashMap<>(numDevices * portsPerDevice);
Map<DeviceId, Timestamp> adOffline = new HashMap<>(numDevices);
for (Entry<DeviceId, Map<ProviderId, DeviceDescriptions>>
provs : deviceDescs.entrySet()) {
deviceDescs.forEach((deviceId, devDescs) -> {
// for each Device...
final DeviceId deviceId = provs.getKey();
final Map<ProviderId, DeviceDescriptions> devDescs = provs.getValue();
synchronized (devDescs) {
// send device offline timestamp
......@@ -1065,7 +1062,7 @@ public class GossipDeviceStore
}
}
}
}
});
return new DeviceAntiEntropyAdvertisement(self, adDevices, adPorts, adOffline);
}
......
......@@ -674,17 +674,13 @@ public class GossipLinkStore
Map<LinkFragmentId, Timestamp> linkTimestamps = new HashMap<>(linkDescs.size());
Map<LinkKey, Timestamp> linkTombstones = new HashMap<>(removedLinks.size());
for (Entry<LinkKey, Map<ProviderId, Timestamped<LinkDescription>>>
provs : linkDescs.entrySet()) {
final LinkKey linkKey = provs.getKey();
final Map<ProviderId, Timestamped<LinkDescription>> linkDesc = provs.getValue();
linkDescs.forEach((linkKey, linkDesc) -> {
synchronized (linkDesc) {
for (Map.Entry<ProviderId, Timestamped<LinkDescription>> e : linkDesc.entrySet()) {
linkTimestamps.put(new LinkFragmentId(linkKey, e.getKey()), e.getValue().timestamp());
}
}
}
});
linkTombstones.putAll(removedLinks);
......