Save memory consumption by avoding unnecessary instantiation
Change-Id: I7ce66c11136653fabc490aa7f33fdadf4454d2cc
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
index d141ed1..c7ce295 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
@@ -18,7 +18,7 @@
import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -95,8 +95,8 @@
new GroupBucketIdentifier(label, sp);
PolicyGroupIdentifier key = new
PolicyGroupIdentifier(id,
- Arrays.asList(param),
- Arrays.asList(bucketId));
+ Collections.singletonList(param),
+ Collections.singletonList(bucketId));
TrafficTreatment.Builder tBuilder =
DefaultTrafficTreatment.builder();
tBuilder.setOutput(sp)
@@ -122,8 +122,8 @@
previousGroupkey);
PolicyGroupIdentifier key = new
PolicyGroupIdentifier(id,
- Arrays.asList(param),
- Arrays.asList(bucketId));
+ Collections.singletonList(param),
+ Collections.singletonList(bucketId));
// Add to group dependency list
dependentGroups.put(previousGroupkey, key);
previousGroupkey = key;
@@ -283,8 +283,8 @@
new GroupBucketIdentifier(label, sp);
PolicyGroupIdentifier key = new
PolicyGroupIdentifier(id,
- Arrays.asList(param),
- Arrays.asList(bucketId));
+ Collections.singletonList(param),
+ Collections.singletonList(bucketId));
previousGroupkey = key;
} else {
// Intermediate Groups
@@ -293,8 +293,8 @@
previousGroupkey);
PolicyGroupIdentifier key = new
PolicyGroupIdentifier(id,
- Arrays.asList(param),
- Arrays.asList(bucketId));
+ Collections.singletonList(param),
+ Collections.singletonList(bucketId));
previousGroupkey = key;
}
}
@@ -348,4 +348,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/core/api/src/test/java/org/onosproject/net/intent/PathIntentTest.java b/core/api/src/test/java/org/onosproject/net/intent/PathIntentTest.java
index b195a54..dfbc184 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/PathIntentTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/PathIntentTest.java
@@ -16,6 +16,7 @@
package org.onosproject.net.intent;
import java.util.Arrays;
+import java.util.Collections;
import org.junit.Test;
import org.onosproject.net.ConnectPoint;
@@ -93,7 +94,7 @@
.appId(APPID)
.selector(MATCH)
.treatment(NOP)
- .path(new DefaultPath(provider1, Arrays.asList(link1), cost))
+ .path(new DefaultPath(provider1, Collections.singletonList(link1), cost))
.build();
}
diff --git a/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java b/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java
index 6601cbf..3c1d77c 100644
--- a/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java
+++ b/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java
@@ -17,8 +17,8 @@
import static org.slf4j.LoggerFactory.getLogger;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
@@ -261,7 +261,7 @@
group.type(),
group.buckets());
groupOps = new GroupOperations(
- Arrays.asList(groupAddOp));
+ Collections.singletonList(groupAddOp));
groupProvider.performGroupOperation(group.deviceId(), groupOps);
break;
@@ -273,7 +273,7 @@
group.type(),
group.buckets());
groupOps = new GroupOperations(
- Arrays.asList(groupModifyOp));
+ Collections.singletonList(groupModifyOp));
groupProvider.performGroupOperation(group.deviceId(), groupOps);
break;
@@ -284,7 +284,7 @@
createDeleteGroupOperation(group.id(),
group.type());
groupOps = new GroupOperations(
- Arrays.asList(groupDeleteOp));
+ Collections.singletonList(groupDeleteOp));
groupProvider.performGroupOperation(group.deviceId(), groupOps);
break;
@@ -335,7 +335,7 @@
group.type(),
group.buckets());
GroupOperations groupOps = new GroupOperations(
- Arrays.asList(groupAddOp));
+ Collections.singletonList(groupAddOp));
gp.performGroupOperation(group.deviceId(), groupOps);
break;
default:
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
index e4f144d..94f85bd 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
@@ -44,7 +44,7 @@
import org.onosproject.net.resource.LinkResourceAllocations;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -104,7 +104,7 @@
for (DeviceId deviceId: outputPorts.keys()) {
rules.addAll(createRules(intent, deviceId, inputPorts.get(deviceId), outputPorts.get(deviceId)));
}
- return Arrays.asList(new FlowRuleIntent(appId, rules, intent.resources()));
+ return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources()));
}
private List<FlowRule> createRules(LinkCollectionIntent intent, DeviceId deviceId,
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
index 557365d..9f835cf 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompiler.java
@@ -52,7 +52,7 @@
import org.onosproject.net.resource.ResourceType;
import org.slf4j.Logger;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -86,7 +86,7 @@
LinkResourceAllocations allocations = assignMplsLabel(intent);
List<FlowRule> rules = generateRules(intent, allocations);
- return Arrays.asList(new FlowRuleIntent(appId, rules, intent.resources()));
+ return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources()));
}
@Activate
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
index 6a5a1f36..d004d6f 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.net.intent.impl.compiler;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -110,7 +110,7 @@
.constraints(intent.constraints())
.build();
- return Arrays.asList(result);
+ return Collections.singletonList(result);
}
/**
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
index e6a20f7..2cf4ccb 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
@@ -46,7 +46,7 @@
import org.onosproject.net.resource.ResourceType;
import org.onosproject.net.topology.TopologyService;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -88,7 +88,8 @@
Set<LinkResourceAllocations> resources) {
LinkResourceAllocations allocations = assignWavelength(intent);
- return Arrays.asList(new FlowRuleIntent(appId, createRules(intent, allocations), intent.resources()));
+ return Collections.singletonList(
+ new FlowRuleIntent(appId, createRules(intent, allocations), intent.resources()));
}
private LinkResourceAllocations assignWavelength(OpticalPathIntent intent) {
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
index d78d6af..61c13e7 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
@@ -38,7 +38,7 @@
import org.onosproject.net.resource.LinkResourceAllocations;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -80,7 +80,7 @@
rules.add(rule);
}
- return Arrays.asList(new FlowRuleIntent(appId, null, rules, intent.resources()));
+ return Collections.singletonList(new FlowRuleIntent(appId, null, rules, intent.resources()));
}
private FlowRule createFlowRule(TrafficSelector originalSelector, TrafficTreatment originalTreatment,
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
index 46e6c66..0021cd2 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.net.intent.impl.compiler;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -77,6 +77,6 @@
.constraints(intent.constraints())
.build();
- return Arrays.asList(result);
+ return Collections.singletonList(result);
}
}
diff --git a/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java b/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
index 8634fb3..c8a32f0 100644
--- a/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
@@ -63,7 +63,6 @@
import org.onosproject.store.trivial.impl.SimpleFlowRuleStore;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -412,7 +411,7 @@
@Override
public Iterable<Device> getDevices() {
- return Arrays.asList(DEV);
+ return Collections.singletonList(DEV);
}
@Override
diff --git a/core/net/src/test/java/org/onosproject/net/group/impl/GroupManagerTest.java b/core/net/src/test/java/org/onosproject/net/group/impl/GroupManagerTest.java
index 9a0ae89..6b5929a 100644
--- a/core/net/src/test/java/org/onosproject/net/group/impl/GroupManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/group/impl/GroupManagerTest.java
@@ -258,9 +258,9 @@
DID,
Group.Type.SELECT,
createdGroup.buckets());
- List<Group> groupEntries = Arrays.asList(createdGroup);
+ List<Group> groupEntries = Collections.singletonList(createdGroup);
providerService.pushGroupMetrics(DID, groupEntries);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_ADDED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_ADDED));
}
// Test group add bucket operations
@@ -296,15 +296,15 @@
addKey,
appId);
GroupBuckets updatedBuckets = new GroupBuckets(buckets);
- List<GroupOperation> expectedGroupOps = Arrays.asList(
- GroupOperation.createModifyGroupOperation(createdGroup.id(),
- Group.Type.SELECT,
- updatedBuckets));
+ List<GroupOperation> expectedGroupOps = Collections.singletonList(
+ GroupOperation.createModifyGroupOperation(createdGroup.id(),
+ Group.Type.SELECT,
+ updatedBuckets));
internalProvider.validate(DID, expectedGroupOps);
Group existingGroup = groupService.getGroup(DID, addKey);
- List<Group> groupEntries = Arrays.asList(existingGroup);
+ List<Group> groupEntries = Collections.singletonList(existingGroup);
providerService.pushGroupMetrics(DID, groupEntries);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_UPDATED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_UPDATED));
}
// Test group remove bucket operations
@@ -340,15 +340,15 @@
removeKey,
appId);
GroupBuckets updatedBuckets = new GroupBuckets(buckets);
- List<GroupOperation> expectedGroupOps = Arrays.asList(
- GroupOperation.createModifyGroupOperation(createdGroup.id(),
- Group.Type.SELECT,
- updatedBuckets));
+ List<GroupOperation> expectedGroupOps = Collections.singletonList(
+ GroupOperation.createModifyGroupOperation(createdGroup.id(),
+ Group.Type.SELECT,
+ updatedBuckets));
internalProvider.validate(DID, expectedGroupOps);
Group existingGroup = groupService.getGroup(DID, removeKey);
- List<Group> groupEntries = Arrays.asList(existingGroup);
+ List<Group> groupEntries = Collections.singletonList(existingGroup);
providerService.pushGroupMetrics(DID, groupEntries);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_UPDATED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_UPDATED));
}
// Test group remove operations
@@ -356,13 +356,13 @@
GroupKey currKey = new DefaultGroupKey("group1RemoveBuckets".getBytes());
Group existingGroup = groupService.getGroup(DID, currKey);
groupService.removeGroup(DID, currKey, appId);
- List<GroupOperation> expectedGroupOps = Arrays.asList(
- GroupOperation.createDeleteGroupOperation(existingGroup.id(),
- Group.Type.SELECT));
+ List<GroupOperation> expectedGroupOps = Collections.singletonList(
+ GroupOperation.createDeleteGroupOperation(existingGroup.id(),
+ Group.Type.SELECT));
internalProvider.validate(DID, expectedGroupOps);
List<Group> groupEntries = Collections.emptyList();
providerService.pushGroupMetrics(DID, groupEntries);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_REMOVED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_REMOVED));
}
/**
@@ -423,7 +423,7 @@
createdGroup.type(),
createdGroup.buckets());
providerService.groupOperationFailed(DID, groupAddOp);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_ADD_FAILED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_ADD_FAILED));
// Group Mod failure test
groupService.addGroup(newGroupDesc);
@@ -435,7 +435,7 @@
createdGroup.type(),
createdGroup.buckets());
providerService.groupOperationFailed(DID, groupModOp);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_UPDATE_FAILED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_UPDATE_FAILED));
// Group Delete failure test
groupService.addGroup(newGroupDesc);
@@ -446,7 +446,7 @@
createDeleteGroupOperation(createdGroup.id(),
createdGroup.type());
providerService.groupOperationFailed(DID, groupDelOp);
- internalListener.validateEvent(Arrays.asList(GroupEvent.Type.GROUP_REMOVE_FAILED));
+ internalListener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_REMOVE_FAILED));
}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
index 2512fee..66bf476 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
@@ -46,7 +46,6 @@
import org.onosproject.net.resource.LinkResourceAllocations;
import org.onosproject.store.trivial.impl.SimpleIntentStore;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -151,7 +150,7 @@
private static class MockInstallableIntent extends FlowRuleIntent {
public MockInstallableIntent() {
- super(APPID, Arrays.asList(new MockFlowRule(100)));
+ super(APPID, Collections.singletonList(new MockFlowRule(100)));
}
}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java
index 00fcf44..32d917f 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java
@@ -38,7 +38,7 @@
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LinkResourceService;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -228,8 +228,8 @@
final LinkResourceService resourceService =
IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0);
- final List<Constraint> constraints = Arrays.asList(
- new BandwidthConstraint(new BandwidthResource(Bandwidth.bps(100.0))));
+ final List<Constraint> constraints =
+ Collections.singletonList(new BandwidthConstraint(new BandwidthResource(Bandwidth.bps(100.0))));
final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
@@ -250,8 +250,8 @@
final LinkResourceService resourceService =
IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0);
- final List<Constraint> constraints = Arrays.asList(
- new BandwidthConstraint(new BandwidthResource(Bandwidth.bps(100.0))));
+ final List<Constraint> constraints =
+ Collections.singletonList(new BandwidthConstraint(new BandwidthResource(Bandwidth.bps(100.0))));
try {
final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
@@ -274,7 +274,8 @@
@Test
public void testLambdaConstrainedIntentSuccess() {
- final List<Constraint> constraints = Arrays.asList(new LambdaConstraint(LambdaResource.valueOf(1)));
+ final List<Constraint> constraints =
+ Collections.singletonList(new LambdaConstraint(LambdaResource.valueOf(1)));
final LinkResourceService resourceService =
IntentTestsMocks.MockResourceService.makeLambdaResourceService(1);
@@ -297,7 +298,8 @@
@Test
public void testLambdaConstrainedIntentFailure() {
- final List<Constraint> constraints = Arrays.asList(new LambdaConstraint(LambdaResource.valueOf(1)));
+ final List<Constraint> constraints =
+ Collections.singletonList(new LambdaConstraint(LambdaResource.valueOf(1)));
final LinkResourceService resourceService =
IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0);
try {
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
index 742b4e2..c15ecae 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
@@ -40,7 +40,7 @@
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.Timestamp;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -70,7 +70,7 @@
private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
private final ConnectPoint cp4 = new ConnectPoint(deviceId("2"), portNumber(2));
- private final List<Link> links = Arrays.asList(new DefaultLink(pid, cp2, cp4, DIRECT));
+ private final List<Link> links = Collections.singletonList(new DefaultLink(pid, cp2, cp4, DIRECT));
private final Path path = new DefaultPath(pid, links, 10);
private PointToPointIntent input;
@@ -118,7 +118,7 @@
public void testMoveToNextPhaseWithoutError() {
IntentData pending = new IntentData(input, INSTALL_REQ, version);
- expect(processor.compile(input, null)).andReturn(Arrays.asList(compiled));
+ expect(processor.compile(input, null)).andReturn(Collections.singletonList(compiled));
replay(processor);
Compiling sut = new Compiling(processor, pending, Optional.empty());
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
index f1ac1f8..8b7be9a 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
@@ -78,7 +78,6 @@
import org.slf4j.Logger;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashSet;
@@ -388,7 +387,7 @@
@Override
public void storeFlowRule(FlowRule rule) {
storeBatch(new FlowRuleBatchOperation(
- Arrays.asList(new FlowRuleBatchEntry(FlowRuleOperation.ADD, rule)),
+ Collections.singletonList(new FlowRuleBatchEntry(FlowRuleOperation.ADD, rule)),
rule.deviceId(), idGenerator.getNewId()));
}
@@ -516,7 +515,7 @@
public void deleteFlowRule(FlowRule rule) {
storeBatch(
new FlowRuleBatchOperation(
- Arrays.asList(
+ Collections.singletonList(
new FlowRuleBatchEntry(
FlowRuleOperation.REMOVE,
rule)), rule.deviceId(), idGenerator.getNewId()));
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java
index 8bfab64..56c4dfb 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/NewDistributedFlowRuleStore.java
@@ -71,7 +71,6 @@
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashSet;
@@ -378,7 +377,7 @@
@Override
public void storeFlowRule(FlowRule rule) {
storeBatch(new FlowRuleBatchOperation(
- Arrays.asList(new FlowRuleBatchEntry(FlowRuleOperation.ADD, rule)),
+ Collections.singletonList(new FlowRuleBatchEntry(FlowRuleOperation.ADD, rule)),
rule.deviceId(), idGenerator.getNewId()));
}
@@ -484,7 +483,7 @@
public void deleteFlowRule(FlowRule rule) {
storeBatch(
new FlowRuleBatchOperation(
- Arrays.asList(
+ Collections.singletonList(
new FlowRuleBatchEntry(
FlowRuleOperation.REMOVE,
rule)), rule.deviceId(), idGenerator.getNewId()));
diff --git a/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleGroupStoreTest.java b/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleGroupStoreTest.java
index 3cf2af3..88e30e5 100644
--- a/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleGroupStoreTest.java
+++ b/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleGroupStoreTest.java
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -307,7 +308,7 @@
PortNumber[] newNeighborPorts = {PortNumber.portNumber(41),
PortNumber.portNumber(42)};
List<PortNumber> newOutPorts = new ArrayList<PortNumber>();
- newOutPorts.addAll(Arrays.asList(newNeighborPorts[0]));
+ newOutPorts.addAll(Collections.singletonList(newNeighborPorts[0]));
List<GroupBucket> toAddBuckets = new ArrayList<GroupBucket>();
for (PortNumber portNumber: newOutPorts) {
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java b/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
index 1ce4381..5424558 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
@@ -73,7 +73,6 @@
import org.slf4j.Logger;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -313,7 +312,7 @@
log.warn("Unsupported Group type {}", group.type());
return;
}
- GroupBuckets bucketsToAdd = new GroupBuckets(Arrays.asList(bucket));
+ GroupBuckets bucketsToAdd = new GroupBuckets(Collections.singletonList(bucket));
groupService.addBucketsToGroup(deviceId, key, bucketsToAdd, key, appId);
}
@@ -339,7 +338,7 @@
log.warn("Unsupported Group type {}", group.type());
return;
}
- GroupBuckets removeBuckets = new GroupBuckets(Arrays.asList(bucket));
+ GroupBuckets removeBuckets = new GroupBuckets(Collections.singletonList(bucket));
groupService.removeBucketsFromGroup(deviceId, key, removeBuckets, key, appId);
}
}