@Test public void testGetHighestVersionMap() { Map<String, String> map = graph.getHighestVersionMap(); Assert.assertEquals("2", map.get("com.google:baz")); Assert.assertEquals("1", map.get("com.google:foo")); Assert.assertEquals("1", map.get("com.google:bar")); Assert.assertEquals("1", map.get("com.google:bat")); Assert.assertEquals(4, map.keySet().size()); }
public Map<String, String> getHighestVersionMap() { Map<String, Collection<String>> input = versions.asMap(); Map<String, String> output = new HashMap<>(); VersionComparator comparator = new VersionComparator(); for (Map.Entry<String, Collection<String>> entry : input.entrySet()) { String highestVersion = Collections.max(entry.getValue(), comparator); output.put(entry.getKey(), highestVersion); } return output; }
DependencyGraph { public Map<String, String> getHighestVersionMap() { Map<String, Collection<String>> input = versions.asMap(); Map<String, String> output = new HashMap<>(); VersionComparator comparator = new VersionComparator(); for (Map.Entry<String, Collection<String>> entry : input.entrySet()) { String highestVersion = Collections.max(entry.getValue(), comparator); output.put(entry.getKey(), highestVersion); } return output; } }
DependencyGraph { public Map<String, String> getHighestVersionMap() { Map<String, Collection<String>> input = versions.asMap(); Map<String, String> output = new HashMap<>(); VersionComparator comparator = new VersionComparator(); for (Map.Entry<String, Collection<String>> entry : input.entrySet()) { String highestVersion = Collections.max(entry.getValue(), comparator); output.put(entry.getKey(), highestVersion); } return output; } DependencyGraph(DependencyNode root); }
DependencyGraph { public Map<String, String> getHighestVersionMap() { Map<String, Collection<String>> input = versions.asMap(); Map<String, String> output = new HashMap<>(); VersionComparator comparator = new VersionComparator(); for (Map.Entry<String, Collection<String>> entry : input.entrySet()) { String highestVersion = Collections.max(entry.getValue(), comparator); output.put(entry.getKey(), highestVersion); } return output; } DependencyGraph(DependencyNode root); void addPath(DependencyPath path); List<DependencyPath> list(); DependencyPath getRootPath(); List<DependencyPath> getChildren(DependencyPath parent); Set<DependencyPath> getPaths(String coordinates); List<Update> findUpdates(); Map<String, String> getHighestVersionMap(); Set<UnresolvableArtifactProblem> getUnresolvedArtifacts(); UnresolvableArtifactProblem createUnresolvableArtifactProblem(Artifact artifact); static DependencyGraph from(DependencyNode root); }
DependencyGraph { public Map<String, String> getHighestVersionMap() { Map<String, Collection<String>> input = versions.asMap(); Map<String, String> output = new HashMap<>(); VersionComparator comparator = new VersionComparator(); for (Map.Entry<String, Collection<String>> entry : input.entrySet()) { String highestVersion = Collections.max(entry.getValue(), comparator); output.put(entry.getKey(), highestVersion); } return output; } DependencyGraph(DependencyNode root); void addPath(DependencyPath path); List<DependencyPath> list(); DependencyPath getRootPath(); List<DependencyPath> getChildren(DependencyPath parent); Set<DependencyPath> getPaths(String coordinates); List<Update> findUpdates(); Map<String, String> getHighestVersionMap(); Set<UnresolvableArtifactProblem> getUnresolvedArtifacts(); UnresolvableArtifactProblem createUnresolvableArtifactProblem(Artifact artifact); static DependencyGraph from(DependencyNode root);  }