File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
app/src/cc/arduino/contributions/libraries/filters Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 2929
3030package cc .arduino .contributions .libraries .filters ;
3131
32+ import java .util .List ;
33+ import java .util .function .Predicate ;
34+
3235import cc .arduino .contributions .VersionComparator ;
3336import cc .arduino .contributions .libraries .ContributedLibrary ;
3437import cc .arduino .contributions .libraries .LibrariesIndexer ;
3538import 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 ;
4139
4240public class UpdatableLibraryPredicate implements Predicate <ContributedLibrary > {
4341
@@ -53,14 +51,12 @@ public UpdatableLibraryPredicate(LibrariesIndexer indexer) {
5351
5452 @ Override
5553 public boolean test (ContributedLibrary lib ) {
56- Optional <UserLibrary > installed = lib .getInstalledLibrary ();
57- if (!installed .isPresent ()) {
54+ if (!lib .isLibraryInstalled ()) {
5855 return false ;
5956 }
60- String installedVersion = installed .get ().getVersion ();
6157 String libraryName = lib .getName ();
6258 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 ( );
6561 }
6662}
You can’t perform that action at this time.
0 commit comments