By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,806 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,806 IT Pros & Developers. It's quick & easy.

how to store multiple values in one key in hash table

P: 126
I want to cache data from database into a hashtable, to which i need a hashtable with multiple values to a common key, Now my question is how do i do this, how do i insert and retrieve data from the hashtable, how do i retrieve a particular value of a key?
Jun 20 '13 #1
Share this Question
Share on Google+
2 Replies

P: 13,264
A Hashtable can store any object including ArrayLists as values.
Jun 21 '13 #2

P: 126
I used LinkedHashMap like this

Expand|Select|Wrap|Line Numbers
  1. LinkedHashMap<String , ArrayList<String>> cache = new LinkedHashMap<>();
Jun 24 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.