public class StringEncoderComparator extends Object implements 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.
| 构造器和说明 |
|---|
StringEncoderComparator()
已过时。
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compare(Object o1,
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals@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(Object o1, Object o2)
EncoderException is encountered, return 0.compare 在接口中 Comparatoro1 - the object to compareo2 - the object to compare toComparableCopyright © 2015. All rights reserved.