public double totalCount() {
    if (currentModCount != cacheModCount) {
      double total = 0.0;
      for (Map.Entry<K, Counter<V>> entry : counterMap.entrySet()) {
        Counter<V> counter = entry.getValue();
        total += counter.totalCount();
      }
      cacheTotalCount = total;
      cacheModCount = currentModCount;
    }
    return cacheTotalCount;
  }