mirror of https://github.com/apache/lucene.git
use singleton BytesRefIterator.EMPTY (no public class)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1304134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e3056ee81d
commit
adfac074ec
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue