Apache Lucene open-source search software
use singleton BytesRefIterator.EMPTY (no public class)
Michael McCandlessadfac074ec28
diff --git a/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java b/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.javaindex 09c9c482d72..f16d6dc13bf 100644--- a/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java+++ b/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java@@ -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() {@Overridepublic BytesRef next() throws IOException {@@ -61,5 +57,5 @@ public interface BytesRefIterator {public Comparator<BytesRef> getComparator() {return null;}- }+ };}diff --git a/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java b/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.javaindex ee835e6ea8b..4bd7f30a645 100755--- a/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java+++ b/modules/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java@@ -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 Dictionary {if (terms != null) {return terms.iterator(null);} else {- return BytesRefIterator.EMPTY_ITERATOR;+ return BytesRefIterator.EMPTY;}}-}