, , , .
, raju HashMap<String, String> hashMap = new HashMap<String, String>(); โ -.
raju -
Map<String, Collection<String>> t
= new HashMap<String, List<String>>();
, .
. Collection<String> , , , , .
This is probably best implemented as a class itself, perhaps
public class MultiValueMap<K, V> extends Map<K, V>
{
...
}
therefore, initialization of the list in the first put(key, value)and subsequent .add(value)list can be hidden in the implementation.
source
share