Save memory consumption by avoding unnecessary instantiation
Change-Id: I7ce66c11136653fabc490aa7f33fdadf4454d2cc
diff --git a/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java b/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
index d141ed1..c7ce295 100644
--- a/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
+++ b/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
+}