Dag H. Wanvik wrote:
"Mamta A. Satoor (JIRA)" <[EMAIL PROTECTED]> writes:


I would like reviewers to take note of following comment at line 125 in the new 
class
                        /* Believe it or not, a String might have more
                         * collation elements than characters.
                         * So, we handle that case by increasing the int array
                         * by 5 and copying array elements.
                         */
Basically, when the characters in the string are converted to collation 
elements, one character can get translated into say 2 collation elements (more 
info can be found on it in this url 
http://www.developertutorials.com/tutorials/java/text-searching-java-050524/page3.html

Would it not be easier/better to just use an  ArrayList<int> to handle
any needed expansion for you (in stead of coding it yourself) and
finally do a toArray()?

Possibly, but I'm not sure an int[] is the long term solution. Looking at RuleBasedCollator it seems to me the better object to cache would be the CollationElementIterator itself, rather than the result of iterating over it. I would say stay with the int[] and the simple array expansion until the functionality is working and then look at improving it. An ArrayList<int> could be expensive, is every int going to be expanded to an Integer object?

Dan.

Reply via email to