This question already has an answer here:
-
Bidirectional multi-valued map in Java
6 answers
Is there an implementation of the following data-structure already implemented in Java:
Say I want the set for '2' ('A', 'C', 'D')
but I also want the set for 'A' ('1', '2')
You have no such data structure in the Java Collections Framework.
I suggest you the guava library you may find something useful there.
Note that what you have here is essentially a undirected graph so keep an eye out for graph libraries (for example JGraphT), or write your own.