Tell the container where you can put such values:
- key1 value1
- key1 value2
- key1 value3
- key2 value4
- key2 value5
- key3 value6
That is, so that one key can store many elements in it.
Tell the container where you can put such values:
That is, so that one key can store many elements in it.
There is such a thing in Google Guava, MultiMap
There is no multimap in the standard Java library (which is in STL C ++). The article describes how you can do this yourself.
Well, you can, for example, do this - implement a class with the key and value fields. Further, just in any necessary (or convenient) container you push objects of this class.
Source: https://ru.stackoverflow.com/questions/166705/
All Articles
Map<KeyType, List<Value>>
? - jmu