Use Collections.singletonList() instead of Arrays.asList() 86/35886/2
authorStephen Kitt <skitt@redhat.com>
Mon, 7 Mar 2016 16:29:52 +0000 (17:29 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 7 Mar 2016 17:15:29 +0000 (17:15 +0000)
... for calls with single parameters.

Change-Id: I9481dde463898f4d49061ed99670e42bf7e9aa25
Signed-off-by: Stephen Kitt <skitt@redhat.com>
common/util/src/main/java/org/opendaylight/yangtools/util/concurrent/QueuedNotificationManager.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/XmlStreamUtilsTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/RetestModel.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/Utils.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TypesResolutionTest.java

index 0e5bd9233189de9d24ffbffe18f257498435c469..17ab583782de7db24706a6d07a9338aacf79372e 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.yangtools.util.concurrent;
 
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ConcurrentHashMap;
@@ -105,7 +105,7 @@ public class QueuedNotificationManager<L,N> implements NotificationManager<L,N>
             return;
         }
 
-        submitNotifications( listener, Arrays.asList( notification ) );
+        submitNotifications( listener, Collections.singletonList(notification));
     }
 
     /* (non-Javadoc)
index e2d4c7f758a5fcf7a435baecc9db7c2b4eda7408..3b436236040f90beda2ddbf2875e4b88bca2a224 100644 (file)
@@ -20,7 +20,7 @@ import java.io.File;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.AbstractMap;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -58,7 +58,7 @@ public class XmlStreamUtilsTest {
     public static void initialize() throws URISyntaxException {
         final YangParserImpl yangParser = new YangParserImpl();
         final File file = new File(XmlStreamUtils.class.getResource("/leafref-test.yang").toURI());
-        schemaContext = yangParser.parseFiles(Arrays.asList(file));
+        schemaContext = yangParser.parseFiles(Collections.singletonList(file));
         assertNotNull(schemaContext);
         assertEquals(1,schemaContext.getModules().size());
         leafRefModule = schemaContext.getModules().iterator().next();
index 9f31295f6dffe52fe6518c7d82640a459ef70fa7..f0d559dd79782b195ac1011ba3feafc1b678713b 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import java.io.InputStream;
 import java.util.Arrays;
+import java.util.Collections;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
@@ -43,6 +45,6 @@ public class RetestModel {
 
     public static SchemaContext createTestContext(String resourcePath) throws ReactorException {
         InputStream yangStream = RetestModel.class.getResourceAsStream(resourcePath);
-        return RetestUtils.parseYangStreams(Arrays.asList(yangStream));
+        return RetestUtils.parseYangStreams(Collections.singletonList(yangStream));
     }
 }
index 1611be92f448c167698d1bcb03df15461b7d1bd6..6d2e0493ecadef10d68b5f2cc239f532a1d0a07f 100644 (file)
@@ -14,7 +14,7 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 import com.google.common.collect.Iterables;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -835,7 +835,7 @@ public final class SchemaContextUtil {
         } else if (node instanceof LeafSchemaNode) {
             return typeDefinition((LeafSchemaNode) node);
         } else {
-            throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object> asList(node).toString());
+            throw new IllegalArgumentException("Unhandled parameter types: " + Collections.<Object>singletonList(node).toString());
         }
     }
 }
index 71ae3700a38b3e075a6bbb384b8adffe934de40c..615881170b2976bf9101f40093ef529ea96b48d5 100644 (file)
@@ -19,6 +19,7 @@ import com.google.common.collect.Iterables;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
@@ -420,7 +421,7 @@ public final class Utils {
         StringBuilder sb = new StringBuilder();
         List<TerminalNode> strings = context.STRING();
         if (strings.isEmpty()) {
-            strings = Arrays.asList(context.IDENTIFIER());
+            strings = Collections.singletonList(context.IDENTIFIER());
         }
         for (TerminalNode stringNode : strings) {
             final String str = stringNode.getText();
index 65d9d5d35c8b582959b9b32048572185b62e5afe..d88f88b19b32f8fb8e5a2724905c6af398b29a63 100644 (file)
@@ -17,6 +17,7 @@ import java.io.File;
 import java.math.BigInteger;
 import java.net.URI;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 import org.junit.Before;
@@ -344,13 +345,13 @@ public class TypesResolutionTest {
     public void testUnionWithBits() throws Exception {
         File unionbits = new File(getClass().getResource("/types/union-with-bits/union-bits-model.yang").toURI());
         YangContextParser parser = new YangParserImpl();
-        parser.parseFiles(Arrays.asList(unionbits));
+        parser.parseFiles(Collections.singletonList(unionbits));
     }
 
     @Test(expected = YangParseException.class)
     public void testUnionInList() throws Exception {
        File unioninlist = new File(getClass().getResource("/types/union-in-list/unioninlisttest.yang").toURI());
        YangContextParser parser = new YangParserImpl();
-       parser.parseFiles(Arrays.asList(unioninlist));
+       parser.parseFiles(Collections.singletonList(unioninlist));
     }
 }