mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-24 04:53:54 +00:00
a little speed-up in Util.addToValueSet, avoiding duplicate look-up
Change-Id: I428fbe0a331e3989c357db5947f046b59ddd6631
This commit is contained in:
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) {
|
||||
|
||||
Reference in new issue
Block a user