I have a map that contains values which could exist for multiple keys. So I figured I needed to setup a map like this: Map<Integer, Set<Long>> myMap = new HashMap<Integer, Set<Long>>
I would like to retrieve a value from a key's set of values.
The problem is that I don't know how to add a long
value to the set in myMap
and I don't know how to check if myMap
contains a value in it's values' set.
Is this implementation incorrect?