I am interested in using the right container for a group of paired values, I am unsure what to use. I understand anything which may have a non unique key, it would be wise to stay away from HashMap etc.
The data is in a structure like this, and its way of structuring tracking tags on sites, some are just page source based, and some only appear after an event, so event based:
Initially I thought of having a two dimensional array, one to store the event based and one to store the page static based. But as the size cannot change, I was unsure.
I plan to iterate over an array dependent on its given event or page basis, drill down on the values that match a page type, say homepage, and scan through all the values for the homepage until it is matched.
I have been reading here, but is there any easy way to do this?
If the Guava and Apache versions aren’t suitable for your purposes (they probably are), you can have a Map<Foo, List<Bar>>
Find the Map section in the Java Tutorials, and it has an example about counting words in. Now, instead of incrementing the count, you can insert a List and populate it with your Bar object. Later on, if you encounter the same List, you can add to it.
That is probably how the multi‑map works. When it says it is not a Map, that means it does not return one V if you use the get() method. That sort of thing is probably your best bet. There is something similar in Apache Commons, but the Guava version seems more versatile.
subject: The best option for paired data, which has duplicate keys