commit | b35ed3691826271040b10b259f7f983d87d91bb3 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Apr 28 11:05:19 2015 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Tue Apr 28 20:17:51 2015 +0000 |
tree | f68007faa2dfaf3c45e37a660929560580cfbfc1 | |
parent | f0c5a052a581a672425469ed76df2e8e04adfae5 [diff] |
Avoid unnecessary empty list instantiation Change-Id: I128485be4e0d7d3400741855e4519f441cfb34c5
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer10.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer10.java index f9ad345..47b5a30 100644 --- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer10.java +++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer10.java
@@ -142,7 +142,7 @@ switch (i.type()) { case DROP: log.warn("Saw drop action; assigning drop action"); - return new LinkedList<>(); + return Collections.emptyList(); case L2MODIFICATION: acts.add(buildL2Modification(i)); break;
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java index 3ba155f..698c77c 100644 --- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java +++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
@@ -194,7 +194,7 @@ for (Instruction i : treatments) { switch (i.type()) { case DROP: - return new LinkedList<>(); + return Collections.emptyList(); case L0MODIFICATION: actions.add(buildL0Modification(i)); break;
diff --git a/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java b/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java index cd88017..0928a93 100644 --- a/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java +++ b/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java
@@ -51,6 +51,7 @@ import org.slf4j.Logger; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Optional; @@ -179,16 +180,16 @@ } private List<OFAction> buildActions(TrafficTreatment treatment) { - List<OFAction> actions = new LinkedList<>(); if (treatment == null) { - return actions; + return Collections.emptyList(); } + List<OFAction> actions = new LinkedList<>(); for (Instruction i : treatment.allInstructions()) { switch (i.type()) { case DROP: log.warn("Saw drop action; assigning drop action"); - return new LinkedList<>(); + return Collections.emptyList(); case L0MODIFICATION: actions.add(buildL0Modification(i)); break;