List of usage examples for java.text RuleBasedCollator getCollationKey
public synchronized CollationKey getCollationKey(String source)
From source file:CollateApp.java
public static void main(String args[]) { if (args.length != 1) { System.out.println("Usage: java CollateApp file"); System.exit(0);/*from ww w.j a v a 2 s .com*/ } Locale defaultLocale = Locale.getDefault(); RuleBasedCollator collator = (RuleBasedCollator) Collator.getInstance(defaultLocale); Vector keyVector = new Vector(); try { BufferedReader in = new BufferedReader(new FileReader(args[0])); String line; while ((line = in.readLine()) != null) keyVector.addElement(collator.getCollationKey(line)); in.close(); } catch (Exception ex) { System.out.println(ex); System.exit(0); } CollationKey keys[] = new CollationKey[keyVector.size()]; for (int i = 0; i < keys.length; ++i) keys[i] = (CollationKey) keyVector.elementAt(i); }
From source file:CollateApp.java
public static void main(String args[]) { if (args.length != 1) { System.out.println("Usage: java CollateApp file"); System.exit(0);// w ww . j av a 2 s . c o m } Locale defaultLocale = Locale.getDefault(); RuleBasedCollator collator = (RuleBasedCollator) Collator.getInstance(defaultLocale); Vector<Object> keyVector = new Vector<Object>(); try { BufferedReader in = new BufferedReader(new FileReader(args[0])); String line; while ((line = in.readLine()) != null) keyVector.addElement(collator.getCollationKey(line)); in.close(); } catch (Exception ex) { System.out.println(ex); System.exit(0); } CollationKey keys[] = new CollationKey[keyVector.size()]; for (int i = 0; i < keys.length; ++i) keys[i] = (CollationKey) keyVector.elementAt(i); }