@Override public List<Module> getMostRecentlyUsed() { List<ModuleUsage> used = dataStore.getUsages(); used.sort((a, b) -> Long.compare(b.getLastSeen(), a.getLastSeen())); return used.stream() .map(u -> modulesMap.get(u.getModuleId())) .filter(m -> m != null) .collect(toList()); }
@Override public long getTotalUsage() { return dataStore.getTotalUsage(); }
@Override public void clear() { dataStore.clear(); }
@Override public void incrementUsageFor(String moduleId) { dataStore.incrementUsageFor(moduleId); }