MavenDependencyCompletionItem (MavenArtifactSearchResult searchResult) { return Collections.max(Arrays.asList(searchResult.getSearchResults().getItems()), Comparator.comparing(r -> { if (r.getType() == null) { return Integer.MIN_VALUE; } return r.getType().getWeight(); })); }