class TopNWindowedMapGauge extends WindowedMapGauge<V> {

    protected Map<String, V> topN(Map<String, V> map)
    {
        Map<String,V> result = new HashMap<>();
        Stream<Map.Entry<String,V>> st = map.entrySet().stream();

        Comparator<Map.Entry<String,V>> comparator = Comparator.comparing(
                (Map.Entry<String, V> e) -> e.getValue())
                .reversed();
        st
                .sorted(comparator)
                .limit(n)
                .forEach(e -> result.put(e.getKey(), e.getValue()));
        return result;
    }

    public  TopNWindowedMapGauge(String name, long windowDurationMs, BiFunction<V, V, V> mergeFunc, int n);
    public  TopNWindowedMapGauge(String name, long windowDurationMs, BiFunction<V, V, V> mergeFunc, int n, Clock clock);

}