Committed by
Gerrit Code Review
Use Objects.nonNull() to check if non-null
Change-Id: Ib32f56c1d53e4199592f457d04660228b7f437aa
Showing
11 changed files
with
30 additions
and
19 deletions
... | @@ -55,6 +55,7 @@ import java.io.IOException; | ... | @@ -55,6 +55,7 @@ import java.io.IOException; |
55 | import java.util.Collections; | 55 | import java.util.Collections; |
56 | import java.util.HashSet; | 56 | import java.util.HashSet; |
57 | import java.util.Map; | 57 | import java.util.Map; |
58 | +import java.util.Objects; | ||
58 | import java.util.Set; | 59 | import java.util.Set; |
59 | import java.util.concurrent.ConcurrentHashMap; | 60 | import java.util.concurrent.ConcurrentHashMap; |
60 | import java.util.stream.Collectors; | 61 | import java.util.stream.Collectors; |
... | @@ -214,7 +215,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { | ... | @@ -214,7 +215,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService { |
214 | return bgpConfig.bgpSpeakers().stream() | 215 | return bgpConfig.bgpSpeakers().stream() |
215 | .flatMap(speaker -> speaker.peers().stream()) | 216 | .flatMap(speaker -> speaker.peers().stream()) |
216 | .map(peer -> interfaceService.getMatchingInterface(peer)) | 217 | .map(peer -> interfaceService.getMatchingInterface(peer)) |
217 | - .filter(intf -> intf != null) | 218 | + .filter(Objects::nonNull) |
218 | .map(intf -> intf.connectPoint()) | 219 | .map(intf -> intf.connectPoint()) |
219 | .collect(Collectors.toSet()); | 220 | .collect(Collectors.toSet()); |
220 | } | 221 | } | ... | ... |
... | @@ -46,6 +46,7 @@ import org.onosproject.store.service.StorageService; | ... | @@ -46,6 +46,7 @@ import org.onosproject.store.service.StorageService; |
46 | import org.slf4j.Logger; | 46 | import org.slf4j.Logger; |
47 | 47 | ||
48 | import java.util.HashSet; | 48 | import java.util.HashSet; |
49 | +import java.util.Objects; | ||
49 | import java.util.Set; | 50 | import java.util.Set; |
50 | import java.util.concurrent.ConcurrentHashMap; | 51 | import java.util.concurrent.ConcurrentHashMap; |
51 | import java.util.stream.Collectors; | 52 | import java.util.stream.Collectors; |
... | @@ -190,7 +191,7 @@ public class DistributedSecurityModeStore | ... | @@ -190,7 +191,7 @@ public class DistributedSecurityModeStore |
190 | } | 191 | } |
191 | 192 | ||
192 | states.computeIf(appId, | 193 | states.computeIf(appId, |
193 | - securityInfo -> (securityInfo != null), | 194 | + Objects::nonNull, |
194 | (id, securityInfo) -> { | 195 | (id, securityInfo) -> { |
195 | switch (securityInfo.getState()) { | 196 | switch (securityInfo.getState()) { |
196 | case POLICY_VIOLATED: | 197 | case POLICY_VIOLATED: | ... | ... |
... | @@ -74,6 +74,7 @@ import org.slf4j.Logger; | ... | @@ -74,6 +74,7 @@ import org.slf4j.Logger; |
74 | 74 | ||
75 | import java.util.Collection; | 75 | import java.util.Collection; |
76 | import java.util.Collections; | 76 | import java.util.Collections; |
77 | +import java.util.Objects; | ||
77 | import java.util.Set; | 78 | import java.util.Set; |
78 | import java.util.concurrent.Executors; | 79 | import java.util.concurrent.Executors; |
79 | import java.util.concurrent.ScheduledExecutorService; | 80 | import java.util.concurrent.ScheduledExecutorService; |
... | @@ -188,12 +189,12 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe | ... | @@ -188,12 +189,12 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe |
188 | switch (fwd.op()) { | 189 | switch (fwd.op()) { |
189 | case ADD: | 190 | case ADD: |
190 | rules.stream() | 191 | rules.stream() |
191 | - .filter(rule -> rule != null) | 192 | + .filter(Objects::nonNull) |
192 | .forEach(flowBuilder::add); | 193 | .forEach(flowBuilder::add); |
193 | break; | 194 | break; |
194 | case REMOVE: | 195 | case REMOVE: |
195 | rules.stream() | 196 | rules.stream() |
196 | - .filter(rule -> rule != null) | 197 | + .filter(Objects::nonNull) |
197 | .forEach(flowBuilder::remove); | 198 | .forEach(flowBuilder::remove); |
198 | break; | 199 | break; |
199 | default: | 200 | default: | ... | ... |
... | @@ -23,6 +23,7 @@ import java.util.Collection; | ... | @@ -23,6 +23,7 @@ import java.util.Collection; |
23 | import java.util.Collections; | 23 | import java.util.Collections; |
24 | import java.util.Deque; | 24 | import java.util.Deque; |
25 | import java.util.List; | 25 | import java.util.List; |
26 | +import java.util.Objects; | ||
26 | import java.util.Set; | 27 | import java.util.Set; |
27 | import java.util.concurrent.ConcurrentHashMap; | 28 | import java.util.concurrent.ConcurrentHashMap; |
28 | 29 | ||
... | @@ -178,12 +179,12 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline | ... | @@ -178,12 +179,12 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline |
178 | switch (fwd.op()) { | 179 | switch (fwd.op()) { |
179 | case ADD: | 180 | case ADD: |
180 | rules.stream() | 181 | rules.stream() |
181 | - .filter(rule -> rule != null) | 182 | + .filter(Objects::nonNull) |
182 | .forEach(flowOpsBuilder::add); | 183 | .forEach(flowOpsBuilder::add); |
183 | break; | 184 | break; |
184 | case REMOVE: | 185 | case REMOVE: |
185 | rules.stream() | 186 | rules.stream() |
186 | - .filter(rule -> rule != null) | 187 | + .filter(Objects::nonNull) |
187 | .forEach(flowOpsBuilder::remove); | 188 | .forEach(flowOpsBuilder::remove); |
188 | break; | 189 | break; |
189 | default: | 190 | default: | ... | ... |
... | @@ -72,6 +72,7 @@ import org.slf4j.Logger; | ... | @@ -72,6 +72,7 @@ import org.slf4j.Logger; |
72 | 72 | ||
73 | import java.util.Collection; | 73 | import java.util.Collection; |
74 | import java.util.Collections; | 74 | import java.util.Collections; |
75 | +import java.util.Objects; | ||
75 | import java.util.Set; | 76 | import java.util.Set; |
76 | import java.util.concurrent.Executors; | 77 | import java.util.concurrent.Executors; |
77 | import java.util.concurrent.ScheduledExecutorService; | 78 | import java.util.concurrent.ScheduledExecutorService; |
... | @@ -173,12 +174,12 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -173,12 +174,12 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
173 | switch (fwd.op()) { | 174 | switch (fwd.op()) { |
174 | case ADD: | 175 | case ADD: |
175 | rules.stream() | 176 | rules.stream() |
176 | - .filter(rule -> rule != null) | 177 | + .filter(Objects::nonNull) |
177 | .forEach(flowBuilder::add); | 178 | .forEach(flowBuilder::add); |
178 | break; | 179 | break; |
179 | case REMOVE: | 180 | case REMOVE: |
180 | rules.stream() | 181 | rules.stream() |
181 | - .filter(rule -> rule != null) | 182 | + .filter(Objects::nonNull) |
182 | .forEach(flowBuilder::remove); | 183 | .forEach(flowBuilder::remove); |
183 | break; | 184 | break; |
184 | default: | 185 | default: | ... | ... |
... | @@ -19,6 +19,7 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -19,6 +19,7 @@ import static org.slf4j.LoggerFactory.getLogger; |
19 | 19 | ||
20 | import java.util.Collection; | 20 | import java.util.Collection; |
21 | import java.util.Collections; | 21 | import java.util.Collections; |
22 | +import java.util.Objects; | ||
22 | 23 | ||
23 | import org.onlab.osgi.ServiceDirectory; | 24 | import org.onlab.osgi.ServiceDirectory; |
24 | import org.onlab.packet.EthType.EtherType; | 25 | import org.onlab.packet.EthType.EtherType; |
... | @@ -104,11 +105,11 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline | ... | @@ -104,11 +105,11 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline |
104 | rules = processForward(fwd); | 105 | rules = processForward(fwd); |
105 | switch (fwd.op()) { | 106 | switch (fwd.op()) { |
106 | case ADD: | 107 | case ADD: |
107 | - rules.stream().filter(rule -> rule != null) | 108 | + rules.stream().filter(Objects::nonNull) |
108 | .forEach(flowOpsBuilder::add); | 109 | .forEach(flowOpsBuilder::add); |
109 | break; | 110 | break; |
110 | case REMOVE: | 111 | case REMOVE: |
111 | - rules.stream().filter(rule -> rule != null) | 112 | + rules.stream().filter(Objects::nonNull) |
112 | .forEach(flowOpsBuilder::remove); | 113 | .forEach(flowOpsBuilder::remove); |
113 | break; | 114 | break; |
114 | default: | 115 | default: | ... | ... |
... | @@ -44,6 +44,7 @@ import org.slf4j.Logger; | ... | @@ -44,6 +44,7 @@ import org.slf4j.Logger; |
44 | 44 | ||
45 | import java.util.Collection; | 45 | import java.util.Collection; |
46 | import java.util.Collections; | 46 | import java.util.Collections; |
47 | +import java.util.Objects; | ||
47 | 48 | ||
48 | import static org.slf4j.LoggerFactory.getLogger; | 49 | import static org.slf4j.LoggerFactory.getLogger; |
49 | 50 | ||
... | @@ -106,12 +107,12 @@ public class OpenstackPipeline extends DefaultSingleTablePipeline | ... | @@ -106,12 +107,12 @@ public class OpenstackPipeline extends DefaultSingleTablePipeline |
106 | switch (forwardingObjective.op()) { | 107 | switch (forwardingObjective.op()) { |
107 | case ADD: | 108 | case ADD: |
108 | rules.stream() | 109 | rules.stream() |
109 | - .filter(rule -> rule != null) | 110 | + .filter(Objects::nonNull) |
110 | .forEach(flowOpsBuilder::add); | 111 | .forEach(flowOpsBuilder::add); |
111 | break; | 112 | break; |
112 | case REMOVE: | 113 | case REMOVE: |
113 | rules.stream() | 114 | rules.stream() |
114 | - .filter(rule -> rule != null) | 115 | + .filter(Objects::nonNull) |
115 | .forEach(flowOpsBuilder::remove); | 116 | .forEach(flowOpsBuilder::remove); |
116 | break; | 117 | break; |
117 | default: | 118 | default: | ... | ... |
... | @@ -59,6 +59,7 @@ import java.util.ArrayList; | ... | @@ -59,6 +59,7 @@ import java.util.ArrayList; |
59 | import java.util.Collection; | 59 | import java.util.Collection; |
60 | import java.util.Collections; | 60 | import java.util.Collections; |
61 | import java.util.List; | 61 | import java.util.List; |
62 | +import java.util.Objects; | ||
62 | import java.util.concurrent.ConcurrentHashMap; | 63 | import java.util.concurrent.ConcurrentHashMap; |
63 | 64 | ||
64 | import static org.slf4j.LoggerFactory.getLogger; | 65 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -129,12 +130,12 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner | ... | @@ -129,12 +130,12 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner |
129 | switch (fwd.op()) { | 130 | switch (fwd.op()) { |
130 | case ADD: | 131 | case ADD: |
131 | rules.stream() | 132 | rules.stream() |
132 | - .filter(rule -> rule != null) | 133 | + .filter(Objects::nonNull) |
133 | .forEach(flowBuilder::add); | 134 | .forEach(flowBuilder::add); |
134 | break; | 135 | break; |
135 | case REMOVE: | 136 | case REMOVE: |
136 | rules.stream() | 137 | rules.stream() |
137 | - .filter(rule -> rule != null) | 138 | + .filter(Objects::nonNull) |
138 | .forEach(flowBuilder::remove); | 139 | .forEach(flowBuilder::remove); |
139 | break; | 140 | break; |
140 | default: | 141 | default: | ... | ... |
... | @@ -54,6 +54,7 @@ import org.slf4j.Logger; | ... | @@ -54,6 +54,7 @@ import org.slf4j.Logger; |
54 | import java.util.ArrayList; | 54 | import java.util.ArrayList; |
55 | import java.util.Collection; | 55 | import java.util.Collection; |
56 | import java.util.Collections; | 56 | import java.util.Collections; |
57 | +import java.util.Objects; | ||
57 | 58 | ||
58 | import static org.slf4j.LoggerFactory.getLogger; | 59 | import static org.slf4j.LoggerFactory.getLogger; |
59 | 60 | ||
... | @@ -120,12 +121,12 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe | ... | @@ -120,12 +121,12 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe |
120 | switch (fwd.op()) { | 121 | switch (fwd.op()) { |
121 | case ADD: | 122 | case ADD: |
122 | rules.stream() | 123 | rules.stream() |
123 | - .filter(rule -> rule != null) | 124 | + .filter(Objects::nonNull) |
124 | .forEach(flowOpsBuilder::add); | 125 | .forEach(flowOpsBuilder::add); |
125 | break; | 126 | break; |
126 | case REMOVE: | 127 | case REMOVE: |
127 | rules.stream() | 128 | rules.stream() |
128 | - .filter(rule -> rule != null) | 129 | + .filter(Objects::nonNull) |
129 | .forEach(flowOpsBuilder::remove); | 130 | .forEach(flowOpsBuilder::remove); |
130 | break; | 131 | break; |
131 | default: | 132 | default: | ... | ... |
... | @@ -82,6 +82,7 @@ import java.util.ArrayList; | ... | @@ -82,6 +82,7 @@ import java.util.ArrayList; |
82 | import java.util.Collection; | 82 | import java.util.Collection; |
83 | import java.util.Collections; | 83 | import java.util.Collections; |
84 | import java.util.List; | 84 | import java.util.List; |
85 | +import java.util.Objects; | ||
85 | import java.util.Set; | 86 | import java.util.Set; |
86 | import java.util.concurrent.Executors; | 87 | import java.util.concurrent.Executors; |
87 | import java.util.concurrent.ScheduledExecutorService; | 88 | import java.util.concurrent.ScheduledExecutorService; |
... | @@ -193,11 +194,11 @@ public class SpringOpenTTP extends AbstractHandlerBehaviour | ... | @@ -193,11 +194,11 @@ public class SpringOpenTTP extends AbstractHandlerBehaviour |
193 | rules = processForward(fwd); | 194 | rules = processForward(fwd); |
194 | switch (fwd.op()) { | 195 | switch (fwd.op()) { |
195 | case ADD: | 196 | case ADD: |
196 | - rules.stream().filter(rule -> rule != null) | 197 | + rules.stream().filter(Objects::nonNull) |
197 | .forEach(flowBuilder::add); | 198 | .forEach(flowBuilder::add); |
198 | break; | 199 | break; |
199 | case REMOVE: | 200 | case REMOVE: |
200 | - rules.stream().filter(rule -> rule != null) | 201 | + rules.stream().filter(Objects::nonNull) |
201 | .forEach(flowBuilder::remove); | 202 | .forEach(flowBuilder::remove); |
202 | break; | 203 | break; |
203 | default: | 204 | default: | ... | ... |
... | @@ -29,6 +29,7 @@ import org.slf4j.Logger; | ... | @@ -29,6 +29,7 @@ import org.slf4j.Logger; |
29 | 29 | ||
30 | import java.util.Collection; | 30 | import java.util.Collection; |
31 | import java.util.List; | 31 | import java.util.List; |
32 | +import java.util.Objects; | ||
32 | import java.util.stream.Collectors; | 33 | import java.util.stream.Collectors; |
33 | 34 | ||
34 | import static com.google.common.base.Preconditions.checkArgument; | 35 | import static com.google.common.base.Preconditions.checkArgument; |
... | @@ -148,7 +149,7 @@ public final class MeterModBuilder { | ... | @@ -148,7 +149,7 @@ public final class MeterModBuilder { |
148 | log.warn("Unknown band type {}", b.type()); | 149 | log.warn("Unknown band type {}", b.type()); |
149 | return null; | 150 | return null; |
150 | } | 151 | } |
151 | - }).filter(value -> value != null).collect(Collectors.toList()); | 152 | + }).filter(Objects::nonNull).collect(Collectors.toList()); |
152 | } | 153 | } |
153 | 154 | ||
154 | private void validate() { | 155 | private void validate() { | ... | ... |
-
Please register or login to post a comment