标签:href guava diff hash put flow add and check
http://stackoverflow.com/questions/19222029/what-is-difference-between-hashmap-and-hashmultimap
The difference is that with the second, Core Java implementation,
you need to check whether the Set is there before you insert. Guava‘s Multimap takes care of that for you.
With Core Java:
Set<String> innerSet = opt.get(key);
if (innerSet == null) {
innerSet = new HashSet<String>();
opt.put(key, innerSet);
}
innerSet.add(value);
With Guava:
opt.put(key, value);
java HashMap and HashMultimap 区别
标签:href guava diff hash put flow add and check
原文地址:http://www.cnblogs.com/qbmiller/p/6789659.html