diff options
Diffstat (limited to 'icu/src/main/java/com')
-rw-r--r-- | icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java index a87c978..3135daa 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java @@ -516,8 +516,17 @@ public final class RuleBasedCollator extends Collator { return result; } - public CollationElementIterator getCollationElementIterator(CharacterIterator source) { - return getCollationElementIterator(source.toString()); + public CollationElementIterator getCollationElementIterator(CharacterIterator it) { + // We only implement the String-based API, so build a string from the iterator. + return getCollationElementIterator(characterIteratorToString(it)); + } + + private String characterIteratorToString(CharacterIterator it) { + StringBuilder result = new StringBuilder(); + for (char ch = it.current(); ch != CharacterIterator.DONE; ch = it.next()) { + result.append(ch); + } + return result.toString(); } /** |