Committed by
Gerrit Code Review
Use filter() to simplify statements in a lambda expression
Change-Id: I66ce281a25830a8cf30ffcc80531efdf03f0b0c0
Showing
1 changed file
with
10 additions
and
9 deletions
... | @@ -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,16 +114,16 @@ public class OLT { | ... | @@ -113,16 +114,16 @@ 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) |
119 | - short vlanId = (short) (fetchVlanId(port.number()) + OFFSET); | 120 | + .forEach(port -> { |
120 | - if (vlanId > 0) { | 121 | + short vlanId = (short) (fetchVlanId(port.number()) + OFFSET); |
121 | - provisionVlanOnPort(gfastDevice, gfastUplink, port.number(), vlanId); | 122 | + if (vlanId > 0) { |
123 | + provisionVlanOnPort(gfastDevice, gfastUplink, port.number(), vlanId); | ||
124 | + } | ||
122 | } | 125 | } |
123 | - } | 126 | + ); |
124 | - } | ||
125 | - ); | ||
126 | log.info("Started with Application ID {}", appId.id()); | 127 | log.info("Started with Application ID {}", appId.id()); |
127 | } | 128 | } |
128 | 129 | ... | ... |
-
Please register or login to post a comment