public void add(T value) {
    int i = segmenter.segment(value);
    counts[i]++;
    totalCount++;
    if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
      this.recentAdditions.pollLast();
    }
    this.recentAdditions.push(value);
  }
@Test
  void badValue() {
    assertThrows(Histogram.SegmenterException.class, () -> {
      Segmenter<String, Long> s = new Histogram.TreeMapSegmenter<>(
          new TreeSet<>(Arrays.asList(0L, 1L, 2L, 4L, 8L, 16L)));

      Histogram<String, Long> h = new Histogram<>(s);
      h.add(-1L);
    });
  }