void (@NotNull K key, @NotNull V value) { ConcurrentMap<K, Object> map = (ConcurrentMap<K, Object>)myMap; while (true) { Object current = map.get(key); if (current == null) { if (ConcurrencyUtil.cacheOrGet(map, key, value) == value) { break; } } else if (current instanceof MostlySingularMultiMap.ValueList) { List<?> curList = (ValueList<?>)current; List<Object> newList = new ValueList<>(curList.size() + 1); newList.addAll(curList); newList.add(value); if (map.replace(key, curList, newList)) break; } else { List<Object> newList = new ValueList<>(2); newList.add(current); newList.add(value); if (map.replace(key, current, newList)) break; } } }