- All Implemented Interfaces:
public class StringEncoderComparator extends Object implements ComparatorCompares Strings using a
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.
- $Id: StringEncoderComparator.java 1468177 2013-04-15 18:35:15Z ggregory $
Methods Modifier and Type Method and Description
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.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
@Deprecated public StringEncoderComparator()Deprecated. Creating an instance without a
StringEncoderleads to a
NullPointerException. Will be removed in 2.0.Constructs a new instance.
public StringEncoderComparator(StringEncoder stringEncoder)Constructs a new instance with the given algorithm.
stringEncoder- the StringEncoder used for comparisons.
compareCompares two strings based not on the strings themselves, but on an encoding of the two strings using the StringEncoder this Comparator was created with. If an
EncoderExceptionis encountered, return
Copyright © 2002–2013 The Apache Software Foundation. All rights reserved.