Sho SHIMIZU
Committed by Gerrit Code Review

Avoid unnecessary empty list instantiation

Change-Id: I128485be4e0d7d3400741855e4519f441cfb34c5
......@@ -142,7 +142,7 @@ public class FlowModBuilderVer10 extends FlowModBuilder {
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;
......
......@@ -194,7 +194,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
for (Instruction i : treatments) {
switch (i.type()) {
case DROP:
return new LinkedList<>();
return Collections.emptyList();
case L0MODIFICATION:
actions.add(buildL0Modification(i));
break;
......
......@@ -51,6 +51,7 @@ import org.projectfloodlight.openflow.types.VlanPcp;
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 @@ public final class GroupModBuilder {
}
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;
......