code: public long getAndSet(final T e, final long occurrences) {
          checkOccurrences(occurrences);
  
          final MutableLong count = valueMap.get(e);
          long result = count == null ? 0 : count.value();
  
          if (occurrences == 0) {
              if (count != null) {
                  valueMap.remove(e);
              }
          } else {
              if (count == null) {
                  valueMap.put(e, MutableLong.of(occurrences));
              } else {
                  count.setValue(occurrences);
              }
          }
  
          return result;
      }
docs: The element will be removed if the specified count is 0.
  
  @param e
  @param occurrences
  @return