how to store multiple values in one key in hash table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PreethiGowri
    New Member
    • Oct 2012
    • 126

    how to store multiple values in one key in hash table

    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?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    A Hashtable can store any object including ArrayLists as values.

    Comment

    • PreethiGowri
      New Member
      • Oct 2012
      • 126

      #3
      I used LinkedHashMap like this

      Code:
      LinkedHashMap<String , ArrayList<String>> cache = new LinkedHashMap<>();

      Comment

      Working...