guava/src/com/google/common/collect/Multisets.java
static <E> boolean setCountImpl(Multiset<E> self, E element, int oldCount, int newCount) {
    checkNonnegative(oldCount, "oldCount");
    checkNonnegative(newCount, "newCount");

    if (self.count(element) == oldCount) {
      self.setCount(element, newCount);
      return true;
    } else {
      return false;
    }
  }
static <E> boolean setCountImpl(Multiset<E> self, E element, int oldCount, int newCount) {
    checkNonnegative(oldCount, "oldCount");
    checkNonnegative(newCount, "newCount");

    if (self.count(element) == oldCount) {
      self.setCount(element, newCount);
      return true;
    } else {
      return false;
    }
  }
static < E > boolean setCountImpl ( Multiset < E > self , E element , int oldCount , int newCount ) { checkNonnegative ( oldCount , "oldCount" ) ; checkNonnegative ( newCount , "newCount" ) ; if ( self . count ( element ) == oldCount ) { self . setCount ( element , newCount ) ; return true ; } else { return false ; } }
An implementation of {@link Multiset#setCount(Object, int, int)}.
An implementation of {