非常简练:
private static void put(MetricKey key, float value) {
MetricValue current;
do {
current = map.get(key);
} while (current == null ? map.putIfAbsent(key, new MetricValue(value)) != null
: !map.replace(key, current, new MetricValue(current, value)));
}