Sharkysoft home

lava.string
Class ToStringCollator

java.lang.Object
  |
  +--java.text.Collator
        |
        +--lava.string.ToStringCollator
All Implemented Interfaces:
java.lang.Cloneable, java.util.Comparator

public class ToStringCollator
extends java.text.Collator

Collates non-string objects.

Details: ToStringCollator functions nearly identically to java.text.Collator, but with one minor improvement: Collation can now occur between Objects that are not Strings. When non-String Objects are collated, this Collator wrapper class automatically converts the Objects to Strings using each Object's toString method.

Since:
1999.04.25

Fields inherited from class java.text.Collator
CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION, IDENTICAL, NO_DECOMPOSITION, PRIMARY, SECONDARY, TERTIARY
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 int compare(java.lang.String s1, java.lang.String s2)
           
 java.text.CollationKey getCollationKey(java.lang.String s)
           
static java.text.Collator getInstance()
           
static java.text.Collator getInstance(java.util.Locale l)
           
 int hashCode()
           
 
Methods inherited from class java.text.Collator
clone, equals, equals, getAvailableLocales, getDecomposition, getStrength, setDecomposition, setStrength
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static java.text.Collator getInstance()

getInstance

public static java.text.Collator getInstance(java.util.Locale l)

getCollationKey

public java.text.CollationKey getCollationKey(java.lang.String s)
Overrides:
getCollationKey in class java.text.Collator

compare

public int compare(java.lang.String s1,
                   java.lang.String s2)
Overrides:
compare in class java.text.Collator

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Overrides:
compare in class java.text.Collator

hashCode

public int hashCode()
Overrides:
hashCode in class java.text.Collator

Sharkysoft home