You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Nils Faupel (Jira)" <ji...@apache.org> on 2022/02/03 20:10:00 UTC
[jira] [Commented] (COLLECTIONS-803) CaseInsensitiveMap prevent duplicate key conversion on put
[ https://issues.apache.org/jira/browse/COLLECTIONS-803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17486686#comment-17486686 ]
Nils Faupel commented on COLLECTIONS-803:
-----------------------------------------
I implemented the solution myself and created a PR on Github: https://github.com/apache/commons-collections/pull/276
> CaseInsensitiveMap prevent duplicate key conversion on put
> ----------------------------------------------------------
>
> Key: COLLECTIONS-803
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-803
> Project: Commons Collections
> Issue Type: Improvement
> Components: Map
> Affects Versions: 4.4
> Reporter: Nils Faupel
> Priority: Minor
> Labels: performance
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When adding a new item into a {{CaseInsensitiveMap }} the {{convertKey(key)}} method is called twice, once in the {{put(key, value)}} method and second in the {{createEntry(next, hashCode, key, value)}} method. The result could be re-used resulting in a better performance. Depending on the {{toString()}} implementation of the key and the resulting length of the key before the lower case conversion the operation can get expensive and should not be called twice.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)