@Test public void gaps() { final Map<Histogram.Range, Double> expect = new HashMap<Histogram.Range, Double>() { { put(new Histogram.Range(0, 1), 1d); put(new Histogram.Range(7, 10), 3d); } }; assertThat(new Histogram(expect.entrySet().stream().map(HistogramTest::map_)).stream().collect(Collectors.toList()), contains(new Histogram.RangeWithCount(new Histogram.Range(0, 1), 1), new Histogram.RangeWithCount(new Histogram.Range(7, 10), 3))); }
public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); }
Histogram implements Serializable, Comparable<Histogram> { public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); } }
Histogram implements Serializable, Comparable<Histogram> { public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); } Histogram(RangeWithCount... items);  Histogram(Stream<RangeWithCount> items); }
Histogram implements Serializable, Comparable<Histogram> { public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); } Histogram(RangeWithCount... items);  Histogram(Stream<RangeWithCount> items); Stream<RangeWithCount> stream(); double getEventCount(); boolean isEmpty(); Optional<Double> min(); Optional<Double> max(); Optional<Double> median(); Optional<Double> avg(); double sum(); double get(double index); double percentile(double percentile); Histogram modifyEventCounters(BiFunction<Range, Double, Double> fn); static Histogram add(Histogram x, Histogram y); static Histogram negate(Histogram x); static Histogram subtract(Histogram x, Histogram y); static Histogram multiply(Histogram x, double y); static Histogram divide(Histogram x, double y); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Histogram o); @Override String toString(); }
Histogram implements Serializable, Comparable<Histogram> { public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); } Histogram(RangeWithCount... items);  Histogram(Stream<RangeWithCount> items); Stream<RangeWithCount> stream(); double getEventCount(); boolean isEmpty(); Optional<Double> min(); Optional<Double> max(); Optional<Double> median(); Optional<Double> avg(); double sum(); double get(double index); double percentile(double percentile); Histogram modifyEventCounters(BiFunction<Range, Double, Double> fn); static Histogram add(Histogram x, Histogram y); static Histogram negate(Histogram x); static Histogram subtract(Histogram x, Histogram y); static Histogram multiply(Histogram x, double y); static Histogram divide(Histogram x, double y); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Histogram o); @Override String toString();  }