< prev index next >

src/java.base/share/classes/java/text/CollationKey.java

Print this page




  78  * sort(keys);
  79  *
  80  * //...
  81  *
  82  * // Inside body of sort routine, compare keys this way
  83  * if (keys[i].compareTo(keys[j]) > 0)
  84  *    // swap keys[i] and keys[j]
  85  *
  86  * //...
  87  *
  88  * // Finally, when we've returned from sort.
  89  * System.out.println(keys[0].getSourceString());
  90  * System.out.println(keys[1].getSourceString());
  91  * System.out.println(keys[2].getSourceString());
  92  * }</pre>
  93  * </blockquote>
  94  *
  95  * @see          Collator
  96  * @see          RuleBasedCollator
  97  * @author       Helena Shih

  98  */
  99 
 100 public abstract class CollationKey implements Comparable<CollationKey> {
 101     /**
 102      * Compare this CollationKey to the target CollationKey. The collation rules of the
 103      * Collator object which created these keys are applied. <strong>Note:</strong>
 104      * CollationKeys created by different Collators can not be compared.
 105      * @param target target CollationKey
 106      * @return Returns an integer value. Value is less than zero if this is less
 107      * than target, value is zero if this and target are equal and value is greater than
 108      * zero if this is greater than target.
 109      * @see java.text.Collator#compare
 110      */
 111     public abstract int compareTo(CollationKey target);
 112 
 113     /**
 114      * Returns the String that this CollationKey represents.
 115      *
 116      * @return the source string of this CollationKey
 117      */




  78  * sort(keys);
  79  *
  80  * //...
  81  *
  82  * // Inside body of sort routine, compare keys this way
  83  * if (keys[i].compareTo(keys[j]) > 0)
  84  *    // swap keys[i] and keys[j]
  85  *
  86  * //...
  87  *
  88  * // Finally, when we've returned from sort.
  89  * System.out.println(keys[0].getSourceString());
  90  * System.out.println(keys[1].getSourceString());
  91  * System.out.println(keys[2].getSourceString());
  92  * }</pre>
  93  * </blockquote>
  94  *
  95  * @see          Collator
  96  * @see          RuleBasedCollator
  97  * @author       Helena Shih
  98  * @since 1.1
  99  */
 100 
 101 public abstract class CollationKey implements Comparable<CollationKey> {
 102     /**
 103      * Compare this CollationKey to the target CollationKey. The collation rules of the
 104      * Collator object which created these keys are applied. <strong>Note:</strong>
 105      * CollationKeys created by different Collators can not be compared.
 106      * @param target target CollationKey
 107      * @return Returns an integer value. Value is less than zero if this is less
 108      * than target, value is zero if this and target are equal and value is greater than
 109      * zero if this is greater than target.
 110      * @see java.text.Collator#compare
 111      */
 112     public abstract int compareTo(CollationKey target);
 113 
 114     /**
 115      * Returns the String that this CollationKey represents.
 116      *
 117      * @return the source string of this CollationKey
 118      */


< prev index next >