commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <>
Subject [collections] MultiMaps...
Date Fri, 13 May 2005 17:20:50 GMT
I have a case in my application where I want to map one key to multiple
values.  However, I don't want the values to be stored as a List.  I would
rather have MultiHashMap store the values in a Set of some kind (HashSet
maybe).  It would be nice if I could tell MultiHashMap what kind of
collection to use to store the values.  Maybe we could parameterize the

public MultiHashMap( Factory factory )

The factory would be used to create a collection instance each time one is
needed for a new key in the map.  Maybe this is overkill and we could just
give it a Class instance and it can call newInstance() on that.  Anyway,
that would allow MultiHashMap to return any kind of collection, not just
Lists.  Of course, I could just create a new Set using the returned List,
but that's a lot of objects to create.  What do you guys think?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message