Collate2public class Collate2 extends Object Comparison of CollationKeys. |
Methods Summary |
---|
public static void | main(java.lang.String[] args)
Collator collator = Collator.getInstance();
show( "default collating", collator );
collator.setStrength( Collator.PRIMARY );
show( "case insensitive", collator );
| public static void | show(java.lang.String tag, java.text.Collator collator)
// allow duplicates in set
OrderedSet set = new OrderedSet( new LessCollationKey(), true );
// add a few entries
set.add( collator.getCollationKey( "Texas" ) );
set.add( collator.getCollationKey( "texas" ) );
set.add( collator.getCollationKey( "Texas Fight" ) );
// print the resulting container
System.out.println( tag );
Enumeration iterator = set.begin();
while ( iterator.hasMoreElements() )
System.out.println( "\t" + ( (CollationKey)iterator.nextElement() ).getSourceString() );
|
|