Replace Stream#forEach() with Collection#forEach()
Change-Id: I2b261c3d91d345907b165bd61eb7b6c45011c247
diff --git a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java
index 1de2455..bd12b5b 100644
--- a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java
+++ b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java
@@ -231,7 +231,7 @@
sIncomingBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(floatingIp.toIpPrefix());
- gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
+ gatewayService.getGatewayDeviceIds().forEach(deviceId -> {
TrafficSelector.Builder sForTrafficFromVmBuilder = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(floatingIp.toIpPrefix())
@@ -278,8 +278,8 @@
.matchIPDst(floatingIp.toIpPrefix())
.build();
- gatewayService.getGatewayDeviceIds().stream().forEach(gnodeId -> {
- TrafficTreatment treatmentForTrafficFromExternal = DefaultTrafficTreatment.builder()
+ gatewayService.getGatewayDeviceIds().forEach(gnodeId -> {
+ TrafficTreatment treatmentForTrafficFromExternal = DefaultTrafficTreatment.builder()
.setEthSrc(Constants.DEFAULT_GATEWAY_MAC)
.setEthDst(associatedVm.mac())
.setIpDst(associatedVm.ipAddresses().stream().findFirst().get())
@@ -336,7 +336,7 @@
.matchIPSrc(associatedVm.ipAddresses().stream().findFirst().get().toIpPrefix())
.build();
- gatewayService.getGatewayDeviceIds().stream().forEach(gnodeId -> {
+ gatewayService.getGatewayDeviceIds().forEach(gnodeId -> {
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setIpSrc(floatingIp)
.setEthSrc(Constants.DEFAULT_GATEWAY_MAC)
diff --git a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackIcmpHandler.java b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackIcmpHandler.java
index 007efb6..27c54f1 100644
--- a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackIcmpHandler.java
+++ b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackIcmpHandler.java
@@ -125,7 +125,7 @@
.matchIPProtocol(IPv4.PROTOCOL_ICMP)
.build();
- gatewayService.getGatewayDeviceIds().stream().forEach(gateway -> {
+ gatewayService.getGatewayDeviceIds().forEach(gateway -> {
packetService.requestPackets(icmpSelector,
PacketPriority.CONTROL,
appId,
diff --git a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java
index 9431e4f..234e9ce 100644
--- a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java
+++ b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java
@@ -315,7 +315,7 @@
}
tBuilder.setIpSrc(externalIp);
- gatewayService.getGatewayNodes().stream().forEach(gateway -> {
+ gatewayService.getGatewayNodes().forEach(gateway -> {
TrafficTreatment.Builder tmpBuilder = DefaultTrafficTreatment.builder(tBuilder.build());
tmpBuilder.setOutput(gatewayService.getUplinkPort(gateway.getGatewayDeviceId()));
ForwardingObjective fo = DefaultForwardingObjective.builder()
@@ -374,7 +374,7 @@
return;
}
- gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
+ gatewayService.getGatewayDeviceIds().forEach(deviceId -> {
DeviceId srcDeviceId = srcVm.get().location().deviceId();
TrafficTreatment.Builder tmpBuilder = DefaultTrafficTreatment.builder(tBuilder.build());
tmpBuilder.extension(RulePopulatorUtil.buildExtension(
@@ -431,4 +431,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackRoutingManager.java b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackRoutingManager.java
index b2de89e..b331746 100644
--- a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackRoutingManager.java
+++ b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackRoutingManager.java
@@ -197,9 +197,7 @@
if (gatewayIp == null) {
return;
}
- gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
- populateGatewayIcmpRule(gatewayIp, deviceId);
- });
+ gatewayService.getGatewayDeviceIds().forEach(deviceId -> populateGatewayIcmpRule(gatewayIp, deviceId));
}
private void populateGatewayIcmpRule(Ip4Address gatewayIp, DeviceId deviceId) {
@@ -371,7 +369,7 @@
}
Map<String, String> vniMap = new HashMap<>();
- openstackService.networks().stream().forEach(n -> vniMap.put(n.id(), n.segmentId()));
+ openstackService.networks().forEach(n -> vniMap.put(n.id(), n.segmentId()));
// TODO improve pipeline, do we have to install access rules between networks
// for every single VMs?
@@ -402,7 +400,7 @@
}
Map<String, String> vniMap = new HashMap<>();
- openstackService.networks().stream().forEach(n -> vniMap.put(n.id(), n.segmentId()));
+ openstackService.networks().forEach(n -> vniMap.put(n.id(), n.segmentId()));
osSubNets.stream().filter(osSubNet -> !osSubNet.id().equals(osSubNetId)).forEach(osSubNet -> {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
diff --git a/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java b/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java
index 1bf5858..a5bcaf5 100644
--- a/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java
+++ b/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java
@@ -663,7 +663,7 @@
prevNodeMap.remove(node.hostname());
addOrUpdateNode(node);
});
- prevNodeMap.values().stream().forEach(this::deleteNode);
+ prevNodeMap.values().forEach(this::deleteNode);
}
private class InternalConfigListener implements NetworkConfigListener {
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java
index d26d9de..aa646ba 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java
@@ -166,17 +166,16 @@
Set<FilteredConnectPoint> ingressFilteredCPs = Sets.newHashSet();
// TODO this should be only peering interfaces
- interfaceService.getInterfaces().stream()
- .forEach(intf -> {
- // Get ony ingress interfaces with IPs configured
- if (validIngressIntf(intf, egressInterface)) {
- TrafficSelector.Builder selector =
- buildIngressTrafficSelector(intf, prefix);
- FilteredConnectPoint ingressFilteredCP =
- new FilteredConnectPoint(intf.connectPoint(), selector.build());
- ingressFilteredCPs.add(ingressFilteredCP);
- }
- });
+ interfaceService.getInterfaces().forEach(intf -> {
+ // Get ony ingress interfaces with IPs configured
+ if (validIngressIntf(intf, egressInterface)) {
+ TrafficSelector.Builder selector =
+ buildIngressTrafficSelector(intf, prefix);
+ FilteredConnectPoint ingressFilteredCP =
+ new FilteredConnectPoint(intf.connectPoint(), selector.build());
+ ingressFilteredCPs.add(ingressFilteredCP);
+ }
+ });
// Build treatment: rewrite the destination MAC address
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java
index 522e540..ede595f 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java
@@ -191,7 +191,7 @@
public VirtualPort getPort(MacAddress mac) {
checkNotNull(mac, MAC_NOT_NULL);
List<VirtualPort> vPorts = new ArrayList<>();
- vPortStore.values().stream().forEach(p -> {
+ vPortStore.values().forEach(p -> {
if (p.macAddress().equals(mac)) {
vPorts.add(p);
}
diff --git a/utils/misc/src/main/java/org/onlab/util/PredictableExecutor.java b/utils/misc/src/main/java/org/onlab/util/PredictableExecutor.java
index 836d3ae..eb1502d 100644
--- a/utils/misc/src/main/java/org/onlab/util/PredictableExecutor.java
+++ b/utils/misc/src/main/java/org/onlab/util/PredictableExecutor.java
@@ -137,7 +137,7 @@
@Override
public void shutdown() {
- backends.stream().forEach(ExecutorService::shutdown);
+ backends.forEach(ExecutorService::shutdown);
}
@Override