@Override
    public <T> List<Pair<String, T>> fetchTop(int size, Type type) throws FailStoreException {

        List<Pair<String, T>> list = new ArrayList<Pair<String, T>>(size);
        if (map.size() == 0) {
            return list;
        }
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            T value = JSON.parse(entry.getValue(), type);
            Pair<String, T> pair = new Pair<String, T>(key, value);
            list.add(pair);
            if (list.size() >= size) {
                break;
            }
        }
        return list;
    }
see http://www.mapdb.org/

@author Robert HG (254963746@qq.com) on 11/10/15.
lts-core/src/main/java/com/github/ltsopensource/core/failstore/mapdb/MapdbFailStore.java