Histogram implements Iterable<Integer> { public int size() { return breaks.length - 1; } Histogram(Iterable<Comparable<?>> data, int binCount);  Histogram(Iterable<Comparable<?>> data, Number... breaks); int size(); int get(int binIndex); @Override Iterator<Integer> iterator();  }
@Test public void testHasDesiredNumberOfBins() { int binCount = 4; Histogram histogram = new Histogram(Collections.<Comparable<?>>emptyList(), binCount); assertThat(histogram.size(), is(4)); }