|
|
|||||||||||||
Class StringComparisonpublic final class StringComparison implements Comparison { // Constructors public static final Comparison ascending = new StringComparison( 1); public static final Comparison descending = new StringComparison( -1); // Methods public int compare(Object p, Object q); } This class provides a simple comparison, similar to that done by String.compareTo. For example, given an array of strings like the following: String strings[] = new String[4]; strings[0]="my"; strings[1]="dog"; strings[2]="has"; strings[3]="fleas"; A sort could be performed with the following code: ArraySort.sort(strings, StringComparison.ascending); ConstructorsStringComparisonpublic static final Comparison ascending = new StringComparison(1); StringComparisonpublic static final Comparison descending = new StringComparison(-1); Methodscomparepublic int compare(Object p, Object q);
|
© 1998 Microsoft Corporation. All rights reserved. Terms of use. |