6486695: [Col] Doc: CollationElementIterator example assumes Collator.getInstance return type

Reviewed-by: okutsu
This commit is contained in:
Naoto Sato 2010-12-09 11:56:38 -08:00
parent f104b182da
commit 3458c499c9

View File

@ -79,9 +79,13 @@ import sun.text.normalizer.NormalizerBase;
* <pre>
*
* String testString = "This is a test";
* RuleBasedCollator ruleBasedCollator = (RuleBasedCollator)Collator.getInstance();
* CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString);
* int primaryOrder = CollationElementIterator.primaryOrder(collationElementIterator.next());
* Collator col = Collator.getInstance();
* if (col instanceof RuleBasedCollator) {
* RuleBasedCollator ruleBasedCollator = (RuleBasedCollator)col;
* CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString);
* int primaryOrder = CollationElementIterator.primaryOrder(collationElementIterator.next());
* :
* }
* </pre>
* </blockquote>
*
@ -93,6 +97,10 @@ import sun.text.normalizer.NormalizerBase;
* is its primary order; the next 8 bits is the secondary order and the
* last 8 bits is the tertiary order.
*
* <p><b>Note:</b> <code>CollationElementIterator</code> is a part of
* <code>RuleBasedCollator</code> implementation. It is only usable
* with <code>RuleBasedCollator</code> instances.
*
* @see Collator
* @see RuleBasedCollator
* @author Helena Shih, Laura Werner, Richard Gillam