BUG-650: optimize MapAdaptor a tiny bit
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / MapAdaptor.java
index 301153afe00fdaec5723d895b76b17271d430444..ebbf488bce89ee0de6c0f133cdcd17d7d4007909 100644 (file)
@@ -8,14 +8,11 @@
 package org.opendaylight.yangtools.util;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
 import com.romix.scala.collection.concurrent.TrieMap;
-
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -127,7 +124,7 @@ public final class MapAdaptor {
          */
         if (size == 0) {
             LOG.trace("Reducing input {} to an empty map", input);
-            return Collections.<K, V>emptyMap();
+            return Collections.emptyMap();
         }
 
         /*
@@ -144,7 +141,7 @@ public final class MapAdaptor {
          * map.
          */
         if (useSingleton && size == 1) {
-            final Entry<K, V> e = Iterables.getOnlyElement(input.entrySet());
+            final Entry<K, V> e = input.entrySet().iterator().next();
             final Map<K, V> ret = Collections.singletonMap(e.getKey(), e.getValue());
             LOG.trace("Reducing input {} to singleton map {}", input, ret);
             return ret;