- final Set<Module> modules = findModuleByNamespace(namespace);
- if (modules.isEmpty()) {
- return null;
- }
-
- if (revision == null) {
- // FIXME: The ordering of modules in Multimap could just guarantee this...
- TreeMap<Date, Module> map = new TreeMap<>();
- for (Module module : modules) {
- map.put(module.getRevision(), module);
- }
- if (map.isEmpty()) {
- return null;
- }
- return map.lastEntry().getValue();
- } else {
- for (Module module : modules) {
- if (module.getRevision().equals(revision)) {
- return(module);
- }
+ for (Module module : findModuleByNamespace(namespace)) {
+ if (revision == null || revision.equals(module.getRevision())) {
+ return module;