Fix non-generic references to HashSet 19/12619/2
authorRobert Varga <rovarga@cisco.com>
Fri, 7 Nov 2014 17:00:58 +0000 (18:00 +0100)
committerRobert Varga <rovarga@cisco.com>
Sat, 8 Nov 2014 11:11:05 +0000 (12:11 +0100)
Adds arguments and changes to use ImmutableSet.of() where that
is more straighforward.

Change-Id: I9f8709cc320ee9804eb2d83e552ec69cc99ee05a
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java

index aac45e18b5d7c420eeae0f6d47b62fdee6cb3078..54977dbc93a53f185b91e8225d832cec05c6b69b 100644 (file)
@@ -59,7 +59,7 @@ public class ValueSerializer {
             return InstanceIdentifierUtils.fromSerializable(
                     node.getInstanceIdentifierValue(), context);
         } else if(node.getIntValueType() == ValueType.BITS_TYPE.ordinal()){
-            return new HashSet(node.getBitsValueList());
+            return new HashSet<>(node.getBitsValueList());
         } else if(node.getIntValueType() == ValueType.BINARY_TYPE.ordinal()){
             return node.getBytesValue().toByteArray();
         }
index d1e3eb202f8faefcafeb548cf2b48ca013b42e91..75e8e2aa4a45c2106b5ccb70baa5a0220b667e74 100644 (file)
@@ -1,15 +1,13 @@
 package org.opendaylight.controller.cluster.datastore.node.utils;
 
+import com.google.common.collect.ImmutableSet;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.util.TestModel;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-
 import static junit.framework.TestCase.assertEquals;
 
 public class PathUtilsTest {
@@ -92,8 +90,7 @@ public class PathUtilsTest {
     }
 
     private YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
-        Set<QName> childNames = new HashSet();
-        childNames.add(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
+        Set<QName> childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
 
         return new YangInstanceIdentifier.AugmentationIdentifier(childNames);
     }
index 6cd06e9c1cea610edc3b1fa2799513cfa539c72c..d15f534f805ee5bc345afcfb05be903f0f9e85e0 100644 (file)
@@ -10,6 +10,7 @@
 
 package org.opendaylight.controller.cluster.datastore.util;
 
+import com.google.common.collect.ImmutableSet;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContext;
@@ -20,7 +21,6 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.List;
 
 public class InstanceIdentifierUtilsTest {
@@ -116,8 +116,8 @@ public class InstanceIdentifierUtilsTest {
 
     @Test
     public void testAugmentationIdentifier() {
-        YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(
-                Arrays.asList(TEST_QNAME)));
+        YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier(
+            ImmutableSet.of(TEST_QNAME));
 
         List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
 
index 7b51d03a97aaa6c9a9d1592eb5ba963ec63e6d8c..b70a7d9d5efa0b9f548150bf3137399e93a76ed4 100644 (file)
@@ -191,7 +191,7 @@ public class XSQLBluePrint implements DatabaseMetaData, Serializable {
     }
 
     public static Set<Class> collectInterfaces(Class cls) {
-        Set<Class> result = new HashSet();
+        Set<Class> result = new HashSet<>();
         Class myInterfaces[] = cls.getInterfaces();
         if (myInterfaces != null) {
             for (Class in : myInterfaces) {