Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6486695

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 6
    • core-libs
    • b123
    • generic
    • generic
    • Verified

      The following example is in CollationElementIterator and assumes that the Collator.getInstance return type is RuleBasedCollator. This assumption is never valid.

        String testString = "This is a test";
        RuleBasedCollator ruleBasedCollator = (RuleBasedCollator)Collator.getInstance();
        CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString);
        int primaryOrder = CollationElementIterator.primaryOrder(collationElementIterator.next());

      The API doc should clarify that it's usable only with RuleBasedCollator. Actually, CollationElementIterator should have never been public.

            naoto Naoto Sato
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: