Committed by
Gerrit Code Review
GossipStores: iterate using forEach
Change-Id: I1c230932ab1c9112692708a4d5c869eac3c50db8
Showing
2 changed files
with
4 additions
and
11 deletions
... | @@ -1032,12 +1032,9 @@ public class GossipDeviceStore | ... | @@ -1032,12 +1032,9 @@ public class GossipDeviceStore |
1032 | Map<PortFragmentId, Timestamp> adPorts = new HashMap<>(numDevices * portsPerDevice); | 1032 | Map<PortFragmentId, Timestamp> adPorts = new HashMap<>(numDevices * portsPerDevice); |
1033 | Map<DeviceId, Timestamp> adOffline = new HashMap<>(numDevices); | 1033 | Map<DeviceId, Timestamp> adOffline = new HashMap<>(numDevices); |
1034 | 1034 | ||
1035 | - for (Entry<DeviceId, Map<ProviderId, DeviceDescriptions>> | 1035 | + deviceDescs.forEach((deviceId, devDescs) -> { |
1036 | - provs : deviceDescs.entrySet()) { | ||
1037 | 1036 | ||
1038 | // for each Device... | 1037 | // for each Device... |
1039 | - final DeviceId deviceId = provs.getKey(); | ||
1040 | - final Map<ProviderId, DeviceDescriptions> devDescs = provs.getValue(); | ||
1041 | synchronized (devDescs) { | 1038 | synchronized (devDescs) { |
1042 | 1039 | ||
1043 | // send device offline timestamp | 1040 | // send device offline timestamp |
... | @@ -1065,7 +1062,7 @@ public class GossipDeviceStore | ... | @@ -1065,7 +1062,7 @@ public class GossipDeviceStore |
1065 | } | 1062 | } |
1066 | } | 1063 | } |
1067 | } | 1064 | } |
1068 | - } | 1065 | + }); |
1069 | 1066 | ||
1070 | return new DeviceAntiEntropyAdvertisement(self, adDevices, adPorts, adOffline); | 1067 | return new DeviceAntiEntropyAdvertisement(self, adDevices, adPorts, adOffline); |
1071 | } | 1068 | } | ... | ... |
... | @@ -674,17 +674,13 @@ public class GossipLinkStore | ... | @@ -674,17 +674,13 @@ public class GossipLinkStore |
674 | Map<LinkFragmentId, Timestamp> linkTimestamps = new HashMap<>(linkDescs.size()); | 674 | Map<LinkFragmentId, Timestamp> linkTimestamps = new HashMap<>(linkDescs.size()); |
675 | Map<LinkKey, Timestamp> linkTombstones = new HashMap<>(removedLinks.size()); | 675 | Map<LinkKey, Timestamp> linkTombstones = new HashMap<>(removedLinks.size()); |
676 | 676 | ||
677 | - for (Entry<LinkKey, Map<ProviderId, Timestamped<LinkDescription>>> | 677 | + linkDescs.forEach((linkKey, linkDesc) -> { |
678 | - provs : linkDescs.entrySet()) { | ||
679 | - | ||
680 | - final LinkKey linkKey = provs.getKey(); | ||
681 | - final Map<ProviderId, Timestamped<LinkDescription>> linkDesc = provs.getValue(); | ||
682 | synchronized (linkDesc) { | 678 | synchronized (linkDesc) { |
683 | for (Map.Entry<ProviderId, Timestamped<LinkDescription>> e : linkDesc.entrySet()) { | 679 | for (Map.Entry<ProviderId, Timestamped<LinkDescription>> e : linkDesc.entrySet()) { |
684 | linkTimestamps.put(new LinkFragmentId(linkKey, e.getKey()), e.getValue().timestamp()); | 680 | linkTimestamps.put(new LinkFragmentId(linkKey, e.getKey()), e.getValue().timestamp()); |
685 | } | 681 | } |
686 | } | 682 | } |
687 | - } | 683 | + }); |
688 | 684 | ||
689 | linkTombstones.putAll(removedLinks); | 685 | linkTombstones.putAll(removedLinks); |
690 | 686 | ... | ... |
-
Please register or login to post a comment