29
29
package cc .arduino .contributions .packages ;
30
30
31
31
import cc .arduino .contributions .DownloadableContributionBuiltInAtTheBottomComparator ;
32
+ import cc .arduino .contributions .filters .DownloadableContributionWithVersionPredicate ;
32
33
import cc .arduino .contributions .filters .InstalledPredicate ;
34
+ import cc .arduino .contributions .packages .filters .PlatformArchitecturePredicate ;
33
35
import com .google .common .base .Function ;
34
- import com .google .common .base .Predicate ;
35
36
import com .google .common .collect .Collections2 ;
36
37
import com .google .common .collect .Iterables ;
37
38
import com .google .common .collect .Lists ;
@@ -59,12 +60,7 @@ public List<ContributedPlatform> findPlatforms(String packageName, final String
59
60
if (aPackage == null ) {
60
61
return null ;
61
62
}
62
- Collection <ContributedPlatform > platforms = Collections2 .filter (aPackage .getPlatforms (), new Predicate <ContributedPlatform >() {
63
- @ Override
64
- public boolean apply (ContributedPlatform contributedPlatform ) {
65
- return platformArch .equals (contributedPlatform .getArchitecture ());
66
- }
67
- });
63
+ Collection <ContributedPlatform > platforms = Collections2 .filter (aPackage .getPlatforms (), new PlatformArchitecturePredicate (platformArch ));
68
64
return Lists .newLinkedList (platforms );
69
65
}
70
66
@@ -79,12 +75,7 @@ public ContributedPlatform findPlatform(String packageName, final String platfor
79
75
return null ;
80
76
}
81
77
82
- Collection <ContributedPlatform > platforms = Collections2 .filter (platformsByName , new Predicate <ContributedPlatform >() {
83
- @ Override
84
- public boolean apply (ContributedPlatform contributedPlatform ) {
85
- return platformVersion .equals (contributedPlatform .getParsedVersion ());
86
- }
87
- });
78
+ Collection <ContributedPlatform > platforms = Collections2 .filter (platformsByName , new DownloadableContributionWithVersionPredicate (platformVersion ));
88
79
if (platforms .isEmpty ()) {
89
80
return null ;
90
81
}
0 commit comments