How to implement a Map with multiple keys? [duplicate]
Two maps. One Map<K1, V>
and one Map<K2, V>
. If you must have a single interface, write a wrapper class that implements said methods.
Commons-collections provides just what you are looking for: https://commons.apache.org/proper/commons-collections/apidocs/
Looks like now the commons-collections is typed.
A typed version can be found at: https://github.com/megamattron/collections-generic
This will exactly support your use case:
MultiKeyMap<k1,k2,...,kn,v> multiMap = ??