public double totalCount() {
    if (currentModCount != cacheModCount) {
      double total = 0.0;
      for (Map.Entry<E, Double> entry : entries.entrySet()) {
        total += entry.getValue();
      }
      cacheTotalCount = total;
      cacheModCount = currentModCount;
    }
    return cacheTotalCount;
  }