Collator GetCollationKey() Example
Transforms the String into a series of bits that can be compared bitwise to other CollationKeys.
Collatorclass GetCollationKey() method example. This example shows you how to use GetCollationKey() method.This method Transforms the String into a series of bits that can be compared bitwise to other CollationKeys.
Here is the code:-
/*
* @Program that Transforms the String into a series of bits that can be
compared bitwise to other CollationKeys.
* GetCollationKey.java
* Author:-RoseIndia Team
* Date:-16-Jun-2008
*/
import java.util.*;
import java.text.*;
public class GetCollationKey {
public static void main(String[] args) {
ArrayList list=new ArrayList();
list.add("r");
list.add("o");
list.add("s");
list.add("e");
Collator collate = Collator.getInstance();
CollationKey[] keys = new CollationKey[list.size()];
for (int k = 0; k < list.size(); k ++)
keys[k] = collate.getCollationKey((String)list.get(k));
for (int l= 0;l < keys.length; l++) {
System.out.println(keys[l].getSourceString());
}
}
} |
|