Return singleton empty collection instead of null in Read service code
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / internal / PortStatisticsConverter.java
index b18eae971b9526fef38a927b798c0a1dccc8e9d9..0fe1c72345810e507c372e379f8e4c8fc3153cbb 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.protocol_plugin.openflow.internal;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.opendaylight.controller.sal.core.Node;
@@ -36,7 +37,7 @@ public class PortStatisticsConverter {
     public PortStatisticsConverter(long switchId, List<OFStatistics> statsList) {
         this.switchId = switchId;
         if (statsList == null || statsList.isEmpty()) {
-            this.ofStatsList = new ArrayList<OFStatistics>(1); // dummy list
+            this.ofStatsList = Collections.emptyList();
         } else {
             this.ofStatsList = new ArrayList<OFStatistics>(statsList);
         }