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() |
public static final AvroCharSequenceComparator<CharSequence> INSTANCE
public int compare(T o1, T o2)
compare
in interface Comparator<T>
Copyright © 2009–2016 The Apache Software Foundation. All rights reserved.