public Map<Object, Double> getTopValues(int number) {
        AssertUtil.isTrue(number > 0, "number must be positive");
        metric.currentWindow();
        List<CacheMap<Object, LongAdder>> buckets = metric.values();

        Map<Object, Long> result = new HashMap<>(buckets.size());

        for (CacheMap<Object, LongAdder> b : buckets) {
            Set<Object> subSet = b.keySet(true);
            for (Object o : subSet) {
                Long count = result.get(o);
                if (count == null) {
                    count = getCount(b.get(o));
                } else {
                    count += getCount(b.get(o));
                }
                result.put(o, count);
            }
        }

        // After merge, get the top set one.
        Set<Entry<Object, Long>> set = result.entrySet();
        List<Entry<Object, Long>> list = new ArrayList<>(set);
        Collections.sort(list, new Comparator<Entry<Object, Long>>() {
            @Override
            public int compare(Entry<Object, Long> a,
                               Entry<Object, Long> b) {
                return (int) (b.getValue() == null ? 0 : b.getValue()) - (int) (a.getValue() == null ? 0 : a.getValue());
            }
        });

        Map<Object, Double> doubleResult = new HashMap<Object, Double>();

        int size = list.size() > number ? number : list.size();
        for (int i = 0; i < size; i++) {
            Map.Entry<Object, Long> x = list.get(i);
            if (x.getValue() == 0) {
                break;
            }
            doubleResult.put(x.getKey(), ((double) x.getValue()) / metric.getIntervalInSecond());
        }

        return doubleResult;
    }
@Test(expected = IllegalArgumentException.class)
    public void testIllegalArgument() {
        ClusterParamMetric metric = new ClusterParamMetric(5, 25, 100);
        metric.getTopValues(-1);
    }