I have a need to set a collection of name/value pairs inside my application - representing effectively a many-to-many map (i.e. keys can have multiple values and vice-versa), so Hashtable and Hashmap don't really work for me.
I'd like to be able to declare these via Spring in a format similar to <props>
, but of course that won't work directly because Properties extends Hashtable itself.
IE, I want to be able to declare something like this:
<entry>
<key><value>KeyOne</value></key>
<value>ValueOne</value>
</entry>
<entry>
<key><value>KeyOne</value></key>
<value>ValueTwo</value>
</entry>
inside a property - but can't use <map>, <props>
, and can't see a good way to use <set>
or <list>
. Any bright ideas?
I don't necessarily need a map-like syntax as in the above; but have that for now as I've initially implemented this code with a HashMap as the actual data structure being set by Spring. After discovering my 1-1 map is really a 1-many or even many-many, here I am.
Thanks.