ObjectHistogram implements Histogram<T, ObjectHistogram<T>>, DistributionComputer { @Override public Set<Integer> buckets() { return hist.keySet(); }  @Override void addElement(T val); @Override Set<Integer> buckets(); @Override Optional<Double> getValue(Integer bucketId); @Override TreeMap<Integer, Double> computeDistributionFunction(); @Override ObjectHistogram<T> plus(ObjectHistogram<T> other); @Override boolean isEqualTo(ObjectHistogram<T> other); abstract Integer mapToBucket(T obj); abstract Double mapToCounter(T obj); abstract ObjectHistogram<T> newInstance();  }
@Test public void testBuckets() { testBuckets(hist1, new int[] {0, 1, 2, 3, 4, 5}, new int[] {4, 3, 2, 1, 1, 1}); testBuckets(hist2, new int[] {0, 1, 5, 6}, new int[] {6, 5, 1, 1}); }