a little speed-up in Util.addToValueSet, avoiding duplicate look-up

Change-Id: I428fbe0a331e3989c357db5947f046b59ddd6631
This commit is contained in:
Axel Uhl committed 2016-07-15 19:46:27 +02:00
1 parent 42429da7a1
commit 9526d78d70
1 file changed
+5 -3
@@ -359,10 +359,12 @@ public class Util {
}
public static <K, V> void addToValueSet(Map<K, Set<V>> map, K key, V value) {
if (! map.containsKey(key)) {
map.put(key, new HashSet<V>());
Set<V> set = map.get(key);
if (set == null) {
set = new HashSet<V>();
map.put(key, set);
}
map.get(key).add(value);
set.add(value);
}
public static <K, V> void removeFromAllValueSets(Map<K, Set<V>> map, V value) {