Have you tried Guava Multimap?
A collection that looks like a map, but that can associate multiple values ββwith a single key. If you call put (K, V) twice with the same key but different values, the multimap contains key mappings for both values.
Depending on the implementation, the multimap may or may not allow double key-value pairs. In other words, after adding the same key and value twice, the multimode content changes between implementations. In multi-characters that allow duplicates, the multi-map will contain two mappings, and get will return a collection that includes the value twice. In multimars that do not support duplicates, the multimap will contain one mapping from key to value, and get will return a collection that includes the value once.
http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Multimap.html
source share