Jesper de Jong wrote:You could do what John Jai says, or use for example Multimap from Google Guava.
Yes, when
is regular Java going to get a Multimap implementation?
@Mohana: Just to add a wrinkle to John's post, another option you might want to consider is a
Map<Key,Set<Value>>. One slight advantage of that setup is that you can't store duplicate (ie,
equal()) values
for the same key, which may or may not be what you want. If it is, then it's probably the way to go.
Winston