File tree 1 file changed +6
-10
lines changed
app/src/cc/arduino/contributions/libraries/filters
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 29
29
30
30
package cc .arduino .contributions .libraries .filters ;
31
31
32
+ import java .util .List ;
33
+ import java .util .function .Predicate ;
34
+
32
35
import cc .arduino .contributions .VersionComparator ;
33
36
import cc .arduino .contributions .libraries .ContributedLibrary ;
34
37
import cc .arduino .contributions .libraries .LibrariesIndexer ;
35
38
import processing .app .BaseNoGui ;
36
- import processing .app .packages .UserLibrary ;
37
-
38
- import java .util .List ;
39
- import java .util .Optional ;
40
- import java .util .function .Predicate ;
41
39
42
40
public class UpdatableLibraryPredicate implements Predicate <ContributedLibrary > {
43
41
@@ -53,14 +51,12 @@ public UpdatableLibraryPredicate(LibrariesIndexer indexer) {
53
51
54
52
@ Override
55
53
public boolean test (ContributedLibrary lib ) {
56
- Optional <UserLibrary > installed = lib .getInstalledLibrary ();
57
- if (!installed .isPresent ()) {
54
+ if (!lib .isLibraryInstalled ()) {
58
55
return false ;
59
56
}
60
- String installedVersion = installed .get ().getVersion ();
61
57
String libraryName = lib .getName ();
62
58
List <ContributedLibrary > libraries = librariesIndexer .getIndex ().find (libraryName );
63
- return libraries .stream ()
64
- . anyMatch ( library -> VersionComparator . greaterThan ( library . getParsedVersion (), installedVersion ) );
59
+ ContributedLibrary latest = libraries .stream (). reduce ( VersionComparator :: max ). get ();
60
+ return ! latest . isLibraryInstalled ( );
65
61
}
66
62
}
You can’t perform that action at this time.
0 commit comments