public class StringEncoderComparator
extends java.lang.Object
implements java.util.Comparator
StringEncoder
. This comparator is used to sort Strings by an encoding scheme such as
Soundex, Metaphone, etc. This class can come in handy if one need to sort Strings by an encoded form of a name such
as Soundex.
This class is immutable and thread-safe.
Constructor and Description |
---|
StringEncoderComparator()
Deprecated.
Creating an instance without a
StringEncoder leads to a NullPointerException . Will be
removed in 2.0. |
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.
|
@Deprecated public StringEncoderComparator()
StringEncoder
leads to a NullPointerException
. Will be
removed in 2.0.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.Comparator
o1
- the object to compareo2
- the object to compare toComparable
Copyright © 2010 - 2020 Adobe. All Rights Reserved