Sho SHIMIZU
Committed by Gerrit Code Review

Use filter() to simplify statements in a lambda expression

Change-Id: I66ce281a25830a8cf30ffcc80531efdf03f0b0c0
...@@ -29,6 +29,7 @@ import org.onlab.util.Tools; ...@@ -29,6 +29,7 @@ import org.onlab.util.Tools;
29 import org.onosproject.core.ApplicationId; 29 import org.onosproject.core.ApplicationId;
30 import org.onosproject.core.CoreService; 30 import org.onosproject.core.CoreService;
31 import org.onosproject.net.DeviceId; 31 import org.onosproject.net.DeviceId;
32 +import org.onosproject.net.Port;
32 import org.onosproject.net.PortNumber; 33 import org.onosproject.net.PortNumber;
33 import org.onosproject.net.device.DeviceEvent; 34 import org.onosproject.net.device.DeviceEvent;
34 import org.onosproject.net.device.DeviceListener; 35 import org.onosproject.net.device.DeviceListener;
...@@ -113,15 +114,15 @@ public class OLT { ...@@ -113,15 +114,15 @@ public class OLT {
113 );*/ 114 );*/
114 115
115 116
116 - deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream().forEach( 117 + deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream()
117 - port -> { 118 + .filter(port -> !port.number().isLogical())
118 - if (!port.number().isLogical() && port.isEnabled()) { 119 + .filter(Port::isEnabled)
120 + .forEach(port -> {
119 short vlanId = (short) (fetchVlanId(port.number()) + OFFSET); 121 short vlanId = (short) (fetchVlanId(port.number()) + OFFSET);
120 if (vlanId > 0) { 122 if (vlanId > 0) {
121 provisionVlanOnPort(gfastDevice, gfastUplink, port.number(), vlanId); 123 provisionVlanOnPort(gfastDevice, gfastUplink, port.number(), vlanId);
122 } 124 }
123 } 125 }
124 - }
125 ); 126 );
126 log.info("Started with Application ID {}", appId.id()); 127 log.info("Started with Application ID {}", appId.id());
127 } 128 }
......