2020import java .util .Comparator ;
2121
2222/**
23- * Strings are comparable, and this comparator allows
24- * you to configure it with an instance of a class
25- * which implements StringEncoder. This comparator
26- * is used to sort Strings by an encoding scheme such
27- * as Soundex, Metaphone, etc. This class can come in
28- * handy if one need to sort Strings by an encoded
29- * form of a name such as Soundex.
30- *
23+ * Compares Strings using a {@link StringEncoder}. This comparator is used to sort Strings by an encoding scheme such as
24+ * Soundex, Metaphone, etc. This class can come in handy if one need to sort Strings by an encoded form of a name such
25+ * as Soundex.
26+ *
3127 * @author Apache Software Foundation
3228 * @version $Id$
3329 */
@@ -50,22 +46,24 @@ public StringEncoderComparator() {
5046
5147 /**
5248 * Constructs a new instance with the given algorithm.
53- * @param stringEncoder the StringEncoder used for comparisons.
49+ *
50+ * @param stringEncoder
51+ * the StringEncoder used for comparisons.
5452 */
5553 public StringEncoderComparator (StringEncoder stringEncoder ) {
5654 this .stringEncoder = stringEncoder ;
5755 }
5856
5957 /**
60- * Compares two strings based not on the strings
61- * themselves, but on an encoding of the two
62- * strings using the StringEncoder this Comparator
63- * was created with.
58+ * Compares two strings based not on the strings themselves, but on an encoding of the two strings using the
59+ * StringEncoder this Comparator was created with.
6460 *
6561 * If an {@link EncoderException} is encountered, return <code>0</code>.
6662 *
67- * @param o1 the object to compare
68- * @param o2 the object to compare to
63+ * @param o1
64+ * the object to compare
65+ * @param o2
66+ * the object to compare to
6967 * @return the Comparable.compareTo() return code or 0 if an encoding error was caught.
7068 * @see Comparable
7169 */
@@ -77,8 +75,7 @@ public int compare(Object o1, Object o2) {
7775 Comparable s1 = (Comparable ) this .stringEncoder .encode (o1 );
7876 Comparable s2 = (Comparable ) this .stringEncoder .encode (o2 );
7977 compareCode = s1 .compareTo (s2 );
80- }
81- catch (EncoderException ee ) {
78+ } catch (EncoderException ee ) {
8279 compareCode = 0 ;
8380 }
8481 return compareCode ;
0 commit comments