Use filter() to simplify statements in a lambda expression
Change-Id: I66ce281a25830a8cf30ffcc80531efdf03f0b0c0
diff --git a/src/main/java/org/onosproject/olt/OLT.java b/src/main/java/org/onosproject/olt/OLT.java
index fb0d523..c92f47a 100644
--- a/src/main/java/org/onosproject/olt/OLT.java
+++ b/src/main/java/org/onosproject/olt/OLT.java
@@ -29,6 +29,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
@@ -113,16 +114,16 @@
);*/
- deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream().forEach(
- port -> {
- if (!port.number().isLogical() && port.isEnabled()) {
- short vlanId = (short) (fetchVlanId(port.number()) + OFFSET);
- if (vlanId > 0) {
- provisionVlanOnPort(gfastDevice, gfastUplink, port.number(), vlanId);
+ deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream()
+ .filter(port -> !port.number().isLogical())
+ .filter(Port::isEnabled)
+ .forEach(port -> {
+ short vlanId = (short) (fetchVlanId(port.number()) + OFFSET);
+ if (vlanId > 0) {
+ provisionVlanOnPort(gfastDevice, gfastUplink, port.number(), vlanId);
+ }
}
- }
- }
- );
+ );
log.info("Started with Application ID {}", appId.id());
}