Sho SHIMIZU
Committed by Gerrit Code Review

Use Objects.nonNull() to check if non-null

Change-Id: Ib32f56c1d53e4199592f457d04660228b7f437aa
......@@ -55,6 +55,7 @@ import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
......@@ -214,7 +215,7 @@ public class RoutingConfigurationImpl implements RoutingConfigurationService {
return bgpConfig.bgpSpeakers().stream()
.flatMap(speaker -> speaker.peers().stream())
.map(peer -> interfaceService.getMatchingInterface(peer))
.filter(intf -> intf != null)
.filter(Objects::nonNull)
.map(intf -> intf.connectPoint())
.collect(Collectors.toSet());
}
......
......@@ -46,6 +46,7 @@ import org.onosproject.store.service.StorageService;
import org.slf4j.Logger;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
......@@ -190,7 +191,7 @@ public class DistributedSecurityModeStore
}
states.computeIf(appId,
securityInfo -> (securityInfo != null),
Objects::nonNull,
(id, securityInfo) -> {
switch (securityInfo.getState()) {
case POLICY_VIOLATED:
......
......@@ -74,6 +74,7 @@ import org.slf4j.Logger;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
......@@ -188,12 +189,12 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe
switch (fwd.op()) {
case ADD:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowBuilder::add);
break;
case REMOVE:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowBuilder::remove);
break;
default:
......
......@@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
......@@ -178,12 +179,12 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline
switch (fwd.op()) {
case ADD:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowOpsBuilder::add);
break;
case REMOVE:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowOpsBuilder::remove);
break;
default:
......
......@@ -72,6 +72,7 @@ import org.slf4j.Logger;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
......@@ -173,12 +174,12 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli
switch (fwd.op()) {
case ADD:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowBuilder::add);
break;
case REMOVE:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowBuilder::remove);
break;
default:
......
......@@ -19,6 +19,7 @@ import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.packet.EthType.EtherType;
......@@ -104,11 +105,11 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline
rules = processForward(fwd);
switch (fwd.op()) {
case ADD:
rules.stream().filter(rule -> rule != null)
rules.stream().filter(Objects::nonNull)
.forEach(flowOpsBuilder::add);
break;
case REMOVE:
rules.stream().filter(rule -> rule != null)
rules.stream().filter(Objects::nonNull)
.forEach(flowOpsBuilder::remove);
break;
default:
......
......@@ -44,6 +44,7 @@ import org.slf4j.Logger;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -106,12 +107,12 @@ public class OpenstackPipeline extends DefaultSingleTablePipeline
switch (forwardingObjective.op()) {
case ADD:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowOpsBuilder::add);
break;
case REMOVE:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowOpsBuilder::remove);
break;
default:
......
......@@ -59,6 +59,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -129,12 +130,12 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner
switch (fwd.op()) {
case ADD:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowBuilder::add);
break;
case REMOVE:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowBuilder::remove);
break;
default:
......
......@@ -54,6 +54,7 @@ import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -120,12 +121,12 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
switch (fwd.op()) {
case ADD:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowOpsBuilder::add);
break;
case REMOVE:
rules.stream()
.filter(rule -> rule != null)
.filter(Objects::nonNull)
.forEach(flowOpsBuilder::remove);
break;
default:
......
......@@ -82,6 +82,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
......@@ -193,11 +194,11 @@ public class SpringOpenTTP extends AbstractHandlerBehaviour
rules = processForward(fwd);
switch (fwd.op()) {
case ADD:
rules.stream().filter(rule -> rule != null)
rules.stream().filter(Objects::nonNull)
.forEach(flowBuilder::add);
break;
case REMOVE:
rules.stream().filter(rule -> rule != null)
rules.stream().filter(Objects::nonNull)
.forEach(flowBuilder::remove);
break;
default:
......
......@@ -29,6 +29,7 @@ import org.slf4j.Logger;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkArgument;
......@@ -148,7 +149,7 @@ public final class MeterModBuilder {
log.warn("Unknown band type {}", b.type());
return null;
}
}).filter(value -> value != null).collect(Collectors.toList());
}).filter(Objects::nonNull).collect(Collectors.toList());
}
private void validate() {
......