android - What Java Collection to use in this case? -


i java novice , trying figure out java collection use flatten values json java collection don't know collection use. here getting json:

user: tim product: beer

user: tim product: bread

user: tim product: milk

user: tim product: soap

user: michael product: soap

user: michael product: coffee

user: michael product: car

user: wayne product: bread

user: wayne product: soap

as can see users have following products: tim: beer, bread, milk, soap michael: soap, coffee, car wayne: bread, soap

what best collection use store these can determine products held 1 user?

for example, providing key=michael, soap, coffee, car.

much appreciated,

depends on usecase data. seems map choice.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -