You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michael (JIRA)" <ji...@apache.org> on 2008/07/05 20:48:37 UTC
[jira] Created: (COLLECTIONS-301) Provide SingleValueMap
Provide SingleValueMap
----------------------
Key: COLLECTIONS-301
URL: https://issues.apache.org/jira/browse/COLLECTIONS-301
Project: Commons Collections
Issue Type: New Feature
Components: Map
Affects Versions: 3.2
Reporter: Michael
I miss an efficient implementation of a SingleValueMap.
The idea goes as follows:
Map<String, String> map = new SingleValueMap<String, String>();
map.put("hello","greeting");
map.put("hola","greeting");
map.put("hallo",greeting");
a normal map would now hold three copies of "greeting". A SingleValueMap would contain only one copy of this value. All keys would map to one copy, identically to a N:1 relaton.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COLLECTIONS-301) Provide SingleValueMap
Posted by "Michael (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610728#action_12610728 ]
Michael commented on COLLECTIONS-301:
-------------------------------------
Henri,
I re-read java.util.Map and there is no such information whatsoever. Do you have any link proving this actually?
If you are 100 % sure, this is great news for me and this ticket can be closed.
> Provide SingleValueMap
> ----------------------
>
> Key: COLLECTIONS-301
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-301
> Project: Commons Collections
> Issue Type: New Feature
> Components: Map
> Affects Versions: 3.2
> Reporter: Michael
>
> I miss an efficient implementation of a SingleValueMap.
> The idea goes as follows:
> Map<String, String> map = new SingleValueMap<String, String>();
> map.put("hello","greeting");
> map.put("hola","greeting");
> map.put("hallo",greeting");
> a normal map would now hold three copies of "greeting". A SingleValueMap would contain only one copy of this value. All keys would map to one copy, identically to a N:1 relaton.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COLLECTIONS-301) Provide SingleValueMap
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610721#action_12610721 ]
Henri Yandell commented on COLLECTIONS-301:
-------------------------------------------
A normal map would also contain only one copy of that value as it would be String interned. The same would hold for other primitive wrapper classes - the JVM often ensures that they are the same Object instance.
> Provide SingleValueMap
> ----------------------
>
> Key: COLLECTIONS-301
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-301
> Project: Commons Collections
> Issue Type: New Feature
> Components: Map
> Affects Versions: 3.2
> Reporter: Michael
>
> I miss an efficient implementation of a SingleValueMap.
> The idea goes as follows:
> Map<String, String> map = new SingleValueMap<String, String>();
> map.put("hello","greeting");
> map.put("hola","greeting");
> map.put("hallo",greeting");
> a normal map would now hold three copies of "greeting". A SingleValueMap would contain only one copy of this value. All keys would map to one copy, identically to a N:1 relaton.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (COLLECTIONS-301) Provide SingleValueMap
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed COLLECTIONS-301.
-------------------------------------
Resolution: Won't Fix
It's nothing to do with Map, it's a JVM feature. Primitive wrappers and Strings are, to some extent, pooled in the JVM.
For String's the feature is called 'interning', as it can be forced with a call to String.intern(). I'm not sure what the state of things is with the primitive wrappers.
> Provide SingleValueMap
> ----------------------
>
> Key: COLLECTIONS-301
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-301
> Project: Commons Collections
> Issue Type: New Feature
> Components: Map
> Affects Versions: 3.2
> Reporter: Michael
>
> I miss an efficient implementation of a SingleValueMap.
> The idea goes as follows:
> Map<String, String> map = new SingleValueMap<String, String>();
> map.put("hello","greeting");
> map.put("hola","greeting");
> map.put("hallo",greeting");
> a normal map would now hold three copies of "greeting". A SingleValueMap would contain only one copy of this value. All keys would map to one copy, identically to a N:1 relaton.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.