开发者

Hashtable same Key with different value....?

开发者 https://www.devze.com 2023-01-30 16:06 出处:网络
Is it possible with java that a hashtable can map the same keys to different values? ..How can I retrieve both value from h开发者_运维知识库ashtable...you cannot, unless you store the key\'s value as

Is it possible with java that a hashtable can map the same keys to different values? .. How can I retrieve both value from h开发者_运维知识库ashtable...


you cannot, unless you store the key's value as a list of values.

take a look at google's Multimap: http://google-collections.googlecode.com/svn/trunk/javadoc/index.html?com/google/common/collect/Multimap.html


You cant do that, All the keys in the Hash map or Hash Table should be unique.

Else then you need to consider a different Collection

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号