lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r806928 - /lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheImpl.java
Date Sun, 23 Aug 2009 05:12:53 GMT
Author: markrmiller
Date: Sun Aug 23 05:12:53 2009
New Revision: 806928

URL: http://svn.apache.org/viewvc?rev=806928&view=rev
Log:
using entry set is faster than looping on key set when you use map.get(key) in loop

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheImpl.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheImpl.java?rev=806928&r1=806927&r2=806928&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheImpl.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FieldCacheImpl.java Sun Aug 23 05:12:53
2009
@@ -24,6 +24,7 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Set;
 import java.util.WeakHashMap;
 
 import org.apache.lucene.document.NumericField;
@@ -81,13 +82,14 @@
         // that it wasn't GCed before we made hard ref
         if (null != readerKey && cache.readerCache.containsKey(readerKey)) {
           Map innerCache = ((Map)cache.readerCache.get(readerKey));
-          Iterator keys = innerCache.keySet().iterator();
-          while (keys.hasNext()) {
-            Entry entry = (Entry) keys.next();
+          Iterator entrySetIterator = innerCache.entrySet().iterator();
+          while (entrySetIterator.hasNext()) {
+            Map.Entry mapEntry = (Map.Entry) entrySetIterator.next();
+            Entry entry = (Entry) mapEntry.getKey();
             result.add(new CacheEntryImpl(readerKey, entry.field,
                                           cacheType, entry.type,
                                           entry.custom, entry.locale,
-                                          innerCache.get(entry)));
+                                          mapEntry.getValue()));
           }
         }
       }



Mime
View raw message