Skip to content

Commit b832e0d

Browse files
committed
Use anyMatch instead of count in ContributionSelfCheck checks
1 parent d285b7f commit b832e0d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

app/src/cc/arduino/contributions/ContributionsSelfCheck.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,21 @@ public void run() {
7373
updateContributionIndex();
7474
updateLibrariesIndex();
7575

76-
long updatablePlatforms = BaseNoGui.indexer.getPackages().stream()
76+
boolean updatablePlatforms = BaseNoGui.indexer.getPackages().stream()
7777
.flatMap(pack -> pack.getPlatforms().stream())
78-
.filter(new UpdatablePlatformPredicate()).count();
78+
.anyMatch(new UpdatablePlatformPredicate());
7979

80-
long updatableLibraries = BaseNoGui.librariesIndexer.getInstalledLibraries().stream()
81-
.filter(new UpdatableLibraryPredicate())
82-
.count();
80+
boolean updatableLibraries = BaseNoGui.librariesIndexer.getIndex().getLibraries().stream()
81+
.anyMatch(new UpdatableLibraryPredicate());
8382

84-
if (updatableLibraries <= 0 && updatablePlatforms <= 0) {
83+
if (!updatableLibraries && !updatablePlatforms) {
8584
return;
8685
}
8786

8887
String text;
89-
if (updatableLibraries > 0 && updatablePlatforms <= 0) {
88+
if (updatableLibraries && !updatablePlatforms) {
9089
text = I18n.format(tr("Updates available for some of your {0}libraries{1}"), "<a href=\"http://librarymanager/DropdownUpdatableLibrariesItem\">", "</a>");
91-
} else if (updatableLibraries <= 0 && updatablePlatforms > 0) {
90+
} else if (!updatableLibraries && updatablePlatforms) {
9291
text = I18n.format(tr("Updates available for some of your {0}boards{1}"), "<a href=\"http://boardsmanager/DropdownUpdatableCoresItem\">", "</a>");
9392
} else {
9493
text = I18n.format(tr("Updates available for some of your {0}boards{1} and {2}libraries{3}"), "<a href=\"http://boardsmanager/DropdownUpdatableCoresItem\">", "</a>", "<a href=\"http://librarymanager/DropdownUpdatableLibrariesItem\">", "</a>");

0 commit comments

Comments
 (0)