T
- The type of object to compare.public class AvroCharSequenceComparator<T> extends Object implements Comparator<T>
The only case where comparing Avro objects does not work using their natural
order is when the schema is "string". The Avro string schema maps to
the Java CharSequence
interface, which does not define
equals
, hashCode
, or compareTo
.
Using this comparator enables comparisons between String
and
Utf8
objects that are both valid when working with Avro strings.
Modifier and Type | Field and Description |
---|---|
static AvroCharSequenceComparator<CharSequence> |
INSTANCE
A singleton instance.
|
Constructor and Description |
---|
AvroCharSequenceComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(T o1,
T o2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final AvroCharSequenceComparator<CharSequence> INSTANCE
public int compare(T o1, T o2)
compare
in interface Comparator<T>
Copyright © 2009–2022 The Apache Software Foundation. All rights reserved.