> +
> +   @Inject
> +   StandardDiskImageSupplier(ElasticStackApi api, Function<StandardDrive, 
> WellKnownImage> standardDriveToWellKnownImage) {
> +      this.api = checkNotNull(api, "api");
> +      this.standardDriveToWellKnownImage = 
> checkNotNull(standardDriveToWellKnownImage, "standardDriveToWellKnownImage");
> +   }
> +
> +   @Override
> +   public List<WellKnownImage> get() {
> +      Iterable<StandardDrive> standardDrives = 
> filter(api.listStandardDriveInfo(), new Predicate<StandardDrive>() {
> +         @Override
> +         public boolean apply(StandardDrive input) {
> +            return MediaType.DISK == input.getMedia();
> +         }
> +      });
> +      return newArrayList(transform(standardDrives, 
> standardDriveToWellKnownImage));

I know it's awful and imperative and all, but does this look easier?
```
ImmutableList.Builder images = ImmutableList.builder();
for (StandardDrive drive : api.listStandardDriveInfo()) {
   if (drive.getMedia() == MediaType.DISK) {
      images.add(standardDriveToWellKnownImage.apply(drive));
   }
}
return images.build();
```
?

In any case, use an ImmutableList?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/362/files#r13033999

Reply via email to