0

I am retrieving the data from Database in this format which will be in key , value pair .

| Soft Drinks        | Bottled,Lemon(19)                           
| Soft Drinks        | Bottled,Clear(20)                           
| Ice creams        | Cone,KoolCool(21)                           
| Ice creams        | Stick,KoolCool,Sai,BabaSai(27)              

Please suggest ,Is there any data structure to store this type of data ??

The key is duplicated so i cant use Map .

Pawan
  • 31,545
  • 102
  • 256
  • 434

2 Answers2

1

You could use a Multimap it stores a Collection of entries for each key.

CantTouchDis
  • 51
  • 1
  • 5
1

I would suggest to use Guava Multimap that supports key duplicates

nogard
  • 9,432
  • 6
  • 33
  • 53