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

python - argument must be rect style object - Pygame -

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

c# - Better 64-bit byte array hash -