// Roughly a 33% performance improvement over AbstractMultiset.setCount().
@Override public int setCount(E element, int count) {
checkNonnegative(count, "count");
AtomicInteger existingCounter;
int oldCount;
if (count == 0) {
existingCounter = backingMap.remove(element);
oldCount = getAndSet(existingCounter, count);
} else {
existingCounter = backingMap.get(element);
oldCount = getAndSet(existingCounter, count);
if (existingCounter == null) {
backingMap.put(element, new AtomicInteger(count));
}
}
size += (count - oldCount);
return oldCount;