1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

Fix some linter suggestions

This commit is contained in:
Cristian Maglie 2019-07-15 22:56:08 +02:00 committed by Martino Facchin
parent 745cb01ed5
commit 4dc5176c0f
3 changed files with 7 additions and 7 deletions

View File

@ -62,7 +62,7 @@ public class MultiLibraryInstallDialog extends JDialog {
ALL, NONE, CANCEL ALL, NONE, CANCEL
} }
Result result = Result.CANCEL; private Result result = Result.CANCEL;
public MultiLibraryInstallDialog(Window parent, ContributedLibrary lib, public MultiLibraryInstallDialog(Window parent, ContributedLibrary lib,
List<ContributedLibrary> dependencies) { List<ContributedLibrary> dependencies) {

View File

@ -38,6 +38,8 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cc.arduino.contributions.VersionComparator;
public abstract class LibrariesIndex { public abstract class LibrariesIndex {
public abstract List<ContributedLibrary> getLibraries(); public abstract List<ContributedLibrary> getLibraries();
@ -121,11 +123,8 @@ public abstract class LibrariesIndex {
for (ContributedLibraryDependency dep : requirements) { for (ContributedLibraryDependency dep : requirements) {
// If the current solution already contains this dependency, skip over // If the current solution already contains this dependency, skip over
boolean alreadyInSolution = false; boolean alreadyInSolution = solution.stream()
for (ContributedLibrary c : solution) { .anyMatch(l -> l.getName().equals(dep.getName()));
if (c.getName().equals(dep.getName()))
alreadyInSolution = true;
}
if (alreadyInSolution) if (alreadyInSolution)
continue; continue;
@ -146,7 +145,7 @@ public abstract class LibrariesIndex {
selected = installed.get(); selected = installed.get();
} else { } else {
// otherwise pick the latest version // otherwise pick the latest version
selected = possibleDeps.stream().reduce((a, b) -> b.isBefore(a) ? a : b).get(); selected = possibleDeps.stream().reduce(VersionComparator::max).get();
} }
// Add dependency to the solution and process recursively // Add dependency to the solution and process recursively

View File

@ -73,6 +73,7 @@ public class UnavailableContributedLibrary extends ContributedLibrary {
@Override @Override
public void setCategory(String category) { public void setCategory(String category) {
// Empty
} }
@Override @Override