BUG-650: optimize MapAdaptor a tiny bit
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / MapAdaptor.java
index d1d8b75806d1d54fcc684230680872b5a147580a..ebbf488bce89ee0de6c0f133cdcd17d7d4007909 100644 (file)
@@ -7,18 +7,15 @@
  */
 package org.opendaylight.yangtools.util;
 
+import com.google.common.base.Preconditions;
+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;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-import com.romix.scala.collection.concurrent.TrieMap;
-
 /**
  * A simple layer on top of maps, which performs snapshot mediation and optimization of
  * what the underlying implementation is.
@@ -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,9 +141,9 @@ 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);
+            LOG.trace("Reducing input {} to singleton map {}", input, ret);
             return ret;
         }