### Question:
BasicHistogramAggregator extends ConcurrentMonoidIntTable implements Aggregator { @Override public Cursor sortedCursor() { return newCursor(true); } BasicHistogramAggregator(final String metricId, final DistributionBucket buckets);  BasicHistogramAggregator(final String metricId, final DistributionBucket buckets,
      final int maxCardinality);  BasicHistogramAggregator(final String metricId, final DistributionBucket buckets,
      final int maxCardinality, final int cardinality); @Override void apply(final String[] tags, final long value, final long timestamp); @Override Cursor cursor(); @Override Cursor sortedCursor();  }### Answer:
@Test void testSortedCursor() { DistributionBucket bucket = new DistributionBucket(new long[]{0, 10, 100}); final BasicHistogramAggregator table = new BasicHistogramAggregator("test", bucket); final String[] tagset1 = new String[]{"host", "h1", "colo", "c1"}; final String[] tagset2 = {"host", "h1"}; table.apply(tagset1, -1, CURRENT_TIME); table.apply(tagset1, 0, CURRENT_TIME); table.apply(tagset1, 1L, CURRENT_TIME); table.apply(tagset1, 10, CURRENT_TIME); table.apply(tagset2, 50, CURRENT_TIME); table.apply(tagset2, 100, CURRENT_TIME); table.apply(tagset2, 101, CURRENT_TIME); table.apply(tagset2, 150, CURRENT_TIME); Cursor cursor = table.sortedCursor(); assertTrue(cursor.next()); assertArrayEquals(tagset2, cursor.getTags()); assertEquals("test", cursor.getMetricId()); assertTrue(cursor.next()); assertArrayEquals(tagset1, cursor.getTags()); assertEquals("test", cursor.getMetricId()); }