You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/02/24 18:07:58 UTC
[GitHub] [commons-collections] freya022 commented on pull request #276: COLLECTIONS-803: prevent duplicate call to convertKey on put for CaseInsensitiveMap
freya022 commented on pull request #276:
URL: https://github.com/apache/commons-collections/pull/276#issuecomment-1050121979
I may also suggest changing the `convertKey` method to use `key.toString().toLowerCase(Locale.ROOT)` to convert the non-null key, instead of the char loop.
Benefits include better performance (measured a 2 times increase on my pc), and this is more fitted for the use case, as per the [Character#toLowerCase documentation](https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#toLowerCase(char)):
```
In general, String.toLowerCase() should be used to map characters to lowercase.
String case mapping methods have several benefits over Character case mapping methods.
String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org