code: public static <T> Multiset<Integer> histogram(Multiset<T> data,
        Comparator<? super Integer> comparator) {
      final TreeMultiset<Integer> histogram = TreeMultiset.create(comparator);
  
      for (final Multiset.Entry<T> entry : data.entrySet()) {
        histogram.add(entry.getCount());
      }
  
      return histogram;
    }
docs: Returns a {@link Multiset} whose elements are the counts of the elements in the input
  {@link Multiset}.  This is most useful for generating histograms.  Whether the histogram
  elements are in ascending order or descending order is controlled by {@code comparator}.