public class StringEncoderComparator
extends java.lang.Object
implements java.util.Comparator
| Modifier and Type | Field and Description |
|---|---|
private StringEncoder |
stringEncoder
Internal encoder instance.
|
| Constructor and Description |
|---|
StringEncoderComparator()
Deprecated.
as creating without a StringEncoder will lead to a
broken NullPointerException creating comparator.
|
StringEncoderComparator(StringEncoder stringEncoder)
Constructs a new instance with the given algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares two strings based not on the strings
themselves, but on an encoding of the two
strings using the StringEncoder this Comparator
was created with.
|
private final StringEncoder stringEncoder
public StringEncoderComparator()
public StringEncoderComparator(StringEncoder stringEncoder)
stringEncoder - the StringEncoder used for comparisons.public int compare(java.lang.Object o1,
java.lang.Object o2)
EncoderException is encountered, return 0.compare in interface java.util.Comparatoro1 - the object to compareo2 - the object to compare toComparablecommons-codec version 1.4 - Copyright © 2002-2014 - Apache Software Foundation