mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
Using Collection instead of List on some Library types
This helps in transitioning to GRPC on next commits.
This commit is contained in:
parent
e5e1892037
commit
7da6bd91aa
@ -46,8 +46,10 @@ public class LibraryOfSameTypeComparator implements Comparator<UserLibrary> {
|
|||||||
if (o2.getTypes().isEmpty()) {
|
if (o2.getTypes().isEmpty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!o1.getTypes().get(0).equals(o2.getTypes().get(0))) {
|
String t1 = o1.getTypes().iterator().next();
|
||||||
return o1.getTypes().get(0).compareTo(o2.getTypes().get(0));
|
String t2 = o2.getTypes().iterator().next();
|
||||||
|
if (!t1.equals(t2)) {
|
||||||
|
return t1.compareTo(t2);
|
||||||
}
|
}
|
||||||
return o1.getName().compareTo(o2.getName());
|
return o1.getName().compareTo(o2.getName());
|
||||||
}
|
}
|
||||||
|
@ -1136,7 +1136,7 @@ public class Base {
|
|||||||
LibraryList libs = getSortedLibraries();
|
LibraryList libs = getSortedLibraries();
|
||||||
String lastLibType = null;
|
String lastLibType = null;
|
||||||
for (UserLibrary lib : libs) {
|
for (UserLibrary lib : libs) {
|
||||||
String libType = lib.getTypes().get(0);
|
String libType = lib.getTypes().iterator().next();
|
||||||
if (!libType.equals(lastLibType)) {
|
if (!libType.equals(lastLibType)) {
|
||||||
if (lastLibType != null) {
|
if (lastLibType != null) {
|
||||||
importMenu.addSeparator();
|
importMenu.addSeparator();
|
||||||
@ -1221,7 +1221,7 @@ public class Base {
|
|||||||
// Get the library's location - used for sorting into categories
|
// Get the library's location - used for sorting into categories
|
||||||
Location location = lib.getLocation();
|
Location location = lib.getLocation();
|
||||||
// Is this library compatible?
|
// Is this library compatible?
|
||||||
List<String> arch = lib.getArchitectures();
|
Collection<String> arch = lib.getArchitectures();
|
||||||
boolean compatible;
|
boolean compatible;
|
||||||
if (myArch == null || arch == null || arch.contains("*")) {
|
if (myArch == null || arch == null || arch.contains("*")) {
|
||||||
compatible = true;
|
compatible = true;
|
||||||
|
@ -43,6 +43,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -599,7 +600,7 @@ public class SketchController {
|
|||||||
// make sure the user didn't hide the sketch folder
|
// make sure the user didn't hide the sketch folder
|
||||||
ensureExistence();
|
ensureExistence();
|
||||||
|
|
||||||
List<String> list = lib.getIncludes();
|
Collection<String> list = lib.getIncludes();
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
File srcFolder = lib.getSrcFolder();
|
File srcFolder = lib.getSrcFolder();
|
||||||
String[] headers = Base.headerListFromIncludePath(srcFolder);
|
String[] headers = Base.headerListFromIncludePath(srcFolder);
|
||||||
|
@ -115,7 +115,7 @@ public class LibrariesIndexer {
|
|||||||
return librariesFolders;
|
return librariesFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserLibraryPriorityComparator priorityComparator = new UserLibraryPriorityComparator(
|
private Comparator<UserLibrary> priorityComparator = new UserLibraryPriorityComparator(
|
||||||
null);
|
null);
|
||||||
|
|
||||||
public void addToInstalledLibraries(UserLibrary lib) {
|
public void addToInstalledLibraries(UserLibrary lib) {
|
||||||
|
@ -36,6 +36,7 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -59,11 +60,11 @@ public class UserLibrary {
|
|||||||
private String website;
|
private String website;
|
||||||
private String category;
|
private String category;
|
||||||
private String license;
|
private String license;
|
||||||
private List<String> architectures;
|
private Collection<String> architectures;
|
||||||
private List<String> types = new ArrayList<>();
|
private Collection<String> types = new ArrayList<>();
|
||||||
private List<String> declaredTypes;
|
private Collection<String> declaredTypes;
|
||||||
private boolean onGoingDevelopment;
|
private boolean onGoingDevelopment;
|
||||||
private List<String> includes;
|
private Collection<String> includes;
|
||||||
protected File installedFolder;
|
protected File installedFolder;
|
||||||
protected Location location;
|
protected Location location;
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ public class UserLibrary {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getArchitectures() {
|
public Collection<String> getArchitectures() {
|
||||||
return architectures;
|
return architectures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,11 +207,11 @@ public class UserLibrary {
|
|||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getTypes() {
|
public Collection<String> getTypes() {
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypes(List<String> types) {
|
public void setTypes(Collection<String> types) {
|
||||||
this.types = types;
|
this.types = types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +235,7 @@ public class UserLibrary {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDeclaredTypes() {
|
public Collection<String> getDeclaredTypes() {
|
||||||
return declaredTypes;
|
return declaredTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +243,7 @@ public class UserLibrary {
|
|||||||
return onGoingDevelopment;
|
return onGoingDevelopment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getIncludes() {
|
public Collection<String> getIncludes() {
|
||||||
return includes;
|
return includes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user