code: @Override
      public int compareTo(Histogram o) {
          int cmp = 0;
          final Iterator<Bucket> iter = buckets_.iterator(), o_iter = o.buckets_.iterator();
          while (cmp == 0 && iter.hasNext() && o_iter.hasNext()) {
              final Bucket next = iter.next(), o_next = o_iter.next();
              cmp = Double.compare(next.getRange().getFloor(), o_next.getRange().getFloor());
              if (cmp == 0)
                  cmp = Double.compare(next.getRange().getCeil(), o_next.getRange().getCeil());
              if (cmp == 0)
                  cmp = Double.compare(next.getEvents(), o_next.getEvents());
          }
  
          if (cmp == 0)
              cmp = (iter.hasNext() ? 1 : (o_iter.hasNext() ? -1 : 0));
          return cmp;
      }
docs: Compare two histograms.