Package org.apache.lucene.util
Class BytesRefComparator
java.lang.Object
org.apache.lucene.util.BytesRefComparator
- All Implemented Interfaces:
Comparator<BytesRef>
Specialized
BytesRef comparator that StringSorter has optimizations for.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BytesRefComparatorComparing ByteRefs in natual order. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBytesRefComparator(int comparedBytesCount) Sole constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intReturn the unsigned byte to use for comparison at indexi, or-1if all bytes that are useful for comparisons are exhausted.final intintCompare two bytes refs that first k bytes are already guaranteed to be equal.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
NATURAL
Comparing ByteRefs in natual order.
-
-
Constructor Details
-
BytesRefComparator
protected BytesRefComparator(int comparedBytesCount) Sole constructor.- Parameters:
comparedBytesCount- the maximum number of bytes to compare.
-
-
Method Details
-
byteAt
Return the unsigned byte to use for comparison at indexi, or-1if all bytes that are useful for comparisons are exhausted. This may only be called with a value ofibetween0included andcomparedBytesCountexcluded. -
compare
- Specified by:
comparein interfaceComparator<BytesRef>
-
compare
Compare two bytes refs that first k bytes are already guaranteed to be equal.
-