BUG-7464: Reduce instanceof checks to null checks
[yangtools.git] / third-party / triemap / src / main / java / org / opendaylight / yangtools / triemap / TrieMap.java
index 881090e7b3b40c93e334e79c27648c088e823e08..3b45b7ed1d3b62e8ee0b738ef7a77b18e2b5d347 100644 (file)
@@ -155,11 +155,9 @@ public class TrieMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K,
     // } while (obj != TrieMapSerializationEnd);
     // }
 
-
     private static <K,V> INode<K,V> newRootNode() {
         final Gen gen = new Gen();
-        final CNode<K, V> cn = new CNode<>(0, new BasicNode[] {}, gen);
-        return new INode<>(gen, cn);
+        return new INode<>(gen, new CNode<>(gen));
     }
 
     final boolean CAS_ROOT (final Object ov, final Object nv) {
@@ -670,7 +668,7 @@ public class TrieMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K,
                 }
 
                 lastReturned = r;
-                if(r instanceof Map.Entry) {
+                if (r != null) {
                     final Map.Entry<K, V> rr = r;
                     return nextEntry(rr);
                 }