Save memory consumption by avoding unnecessary instantiation

Change-Id: I7ce66c11136653fabc490aa7f33fdadf4454d2cc
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);
     }
 }