Remove an unneeded null check 37/34637/3
authorRobert Varga <rovarga@cisco.com>
Sun, 14 Feb 2016 22:29:41 +0000 (23:29 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 17 Feb 2016 09:33:15 +0000 (09:33 +0000)
instanceof performs a null check, hence we do not have to do it
ourselves. Saves a branch.

Change-Id: Icb4e29c5adb94a1c971fa8019064324ef1cadbf2
Signed-off-by: Robert Varga <rovarga@cisco.com>
common/util/src/main/java/org/opendaylight/yangtools/util/ConstantArrayCollection.java

index 8c29d9e0b9949e716bd05190d3ba20260c232bd0..b88a6ef992762d1ec5968fd305460445de8038da 100644 (file)
@@ -145,9 +145,6 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
         if (obj == this) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
         if (!(obj instanceof ConstantArrayCollection)) {
             return false;
         }
@@ -161,7 +158,7 @@ final class ConstantArrayCollection<E> implements Collection<E>, Serializable {
             return "[]";
         }
 
-        StringBuilder sb = new StringBuilder("[");
+        final StringBuilder sb = new StringBuilder("[");
         int i = 0;
         while (i < array.length - 1) {
             sb.append(String.valueOf(array[i++])).append(", ");