You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/03/23 00:33:19 UTC
svn commit: r1304134 - in /lucene/dev/trunk:
lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java
modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
Author: mikemccand
Date: Thu Mar 22 23:33:19 2012
New Revision: 1304134
URL: http://svn.apache.org/viewvc?rev=1304134&view=rev
Log:
use singleton BytesRefIterator.EMPTY (no public class)
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java
lucene/dev/trunk/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java?rev=1304134&r1=1304133&r2=1304134&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java Thu Mar 22 23:33:19 2012
@@ -25,9 +25,6 @@ import java.util.Comparator;
*/
public interface BytesRefIterator {
- /** Singleton BytesRefIterator that iterates over 0 BytesRefs. */
- public static final BytesRefIterator EMPTY_ITERATOR = new EmptyBytesRefIterator();
-
/**
* Increments the iteration to the next {@link BytesRef} in the iterator.
* Returns the resulting {@link BytesRef} or <code>null</code> if the end of
@@ -49,9 +46,8 @@ public interface BytesRefIterator {
*/
public Comparator<BytesRef> getComparator();
- // TODO: private?
- /** Iterates over 0 BytesRefs. */
- public final static class EmptyBytesRefIterator implements BytesRefIterator {
+ /** Singleton BytesRefIterator that iterates over 0 BytesRefs. */
+ public static final BytesRefIterator EMPTY = new BytesRefIterator() {
@Override
public BytesRef next() throws IOException {
@@ -61,5 +57,5 @@ public interface BytesRefIterator {
public Comparator<BytesRef> getComparator() {
return null;
}
- }
+ };
}
Modified: lucene/dev/trunk/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java?rev=1304134&r1=1304133&r2=1304134&view=diff
==============================================================================
--- lucene/dev/trunk/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java (original)
+++ lucene/dev/trunk/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java Thu Mar 22 23:33:19 2012
@@ -30,9 +30,6 @@ import java.io.*;
*
* When using IndexReader.terms(Term) the code must not call next() on TermEnum
* as the first call to TermEnum, see: http://issues.apache.org/jira/browse/LUCENE-6
- *
- *
- *
*/
public class LuceneDictionary implements Dictionary {
private IndexReader reader;
@@ -48,8 +45,7 @@ public class LuceneDictionary implements
if (terms != null) {
return terms.iterator(null);
} else {
- return BytesRefIterator.EMPTY_ITERATOR;
+ return BytesRefIterator.EMPTY;
}
}
-
}