diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectMonotonicReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectMonotonicReader.java index 4b942a4f3d3..724bad01626 100644 --- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectMonotonicReader.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/packed/LegacyDirectMonotonicReader.java @@ -34,16 +34,6 @@ public final class LegacyDirectMonotonicReader extends LongValues implements Acc private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(LegacyDirectMonotonicReader.class); - /** An instance that always returns {@code 0}. */ - private static final LongValues EMPTY = - new LongValues() { - - @Override - public long get(long index) { - return 0; - } - }; - /** * In-memory metadata that needs to be kept around for {@link LegacyDirectMonotonicReader} to read * data from disk. @@ -105,7 +95,7 @@ public final class LegacyDirectMonotonicReader extends LongValues implements Acc final LongValues[] readers = new LongValues[meta.numBlocks]; for (int i = 0; i < meta.mins.length; ++i) { if (meta.bpvs[i] == 0) { - readers[i] = EMPTY; + readers[i] = LongValues.ZEROES; } else { readers[i] = LegacyDirectReader.getInstance(data, meta.bpvs[i], meta.offsets[i]); } diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/DirectMonotonicReader.java b/lucene/core/src/java/org/apache/lucene/util/packed/DirectMonotonicReader.java index 884c664c95f..1f5954ec05f 100644 --- a/lucene/core/src/java/org/apache/lucene/util/packed/DirectMonotonicReader.java +++ b/lucene/core/src/java/org/apache/lucene/util/packed/DirectMonotonicReader.java @@ -34,16 +34,6 @@ public final class DirectMonotonicReader extends LongValues implements Accountab private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(DirectMonotonicReader.class); - /** An instance that always returns {@code 0}. */ - private static final LongValues EMPTY = - new LongValues() { - - @Override - public long get(long index) { - return 0; - } - }; - /** * In-memory metadata that needs to be kept around for {@link DirectMonotonicReader} to read data * from disk. @@ -111,7 +101,7 @@ public final class DirectMonotonicReader extends LongValues implements Accountab final LongValues[] readers = new LongValues[meta.numBlocks]; for (int i = 0; i < meta.numBlocks; ++i) { if (meta.bpvs[i] == 0) { - readers[i] = EMPTY; + readers[i] = LongValues.ZEROES; } else if (merging && i < meta.numBlocks - 1 // we only know the number of values for the last block && meta.blockShift >= DirectReader.MERGE_BUFFER_SHIFT) {