This there any efficient collection to associate a key with multiple values, something like
new HashMap<K,V,V>();
example:
new HashMap<Long, List<CustomerVO>, List<FacilityInfo>>();
Thanks in advance!
This there any efficient collection to associate a key with multiple values, something like
new HashMap<K,V,V>();
example:
new HashMap<Long, List<CustomerVO>, List<FacilityInfo>>();
Thanks in advance!
Have a look at Apache Commons Multimap - it seems to be what you're after:
MultiMap mhm = new MultiHashMap();
mhm.put(key, "A");
mhm.put(key, "B");
mhm.put(key, "C");
Collection coll = (Collection) mhm.get(key);
Alternatively, you can just stick a collection of any kind into a regular map, e.g:
Map<Key, Set<Value>> myMap;
How about Plain Old Java Object approach -
public class CutomerFacilityDetail{
List<CustomerVO> customvoList;
List<FacilityInfo> facilityInfoList;
...<getter & setter method>
}
Now create map -Map<Long,List<CutomerFacilityDetail>>