> +      Set<StorageMetadata> storageMetadatas = new HashSet<StorageMetadata>();
> +
> +      for (JoyentObject joyentObject : form) {
> +         StorageType storageType = null;
> +         if (JoyentObject.TYPE_FOLDER.equals(joyentObject.getContentType())) 
> {
> +            storageType = StorageType.FOLDER;
> +         } else if 
> (JoyentObject.TYPE_BLOB.equals(joyentObject.getContentType())) {
> +            storageType = StorageType.BLOB;
> +         }
> +
> +         Date creationDate = joyentObject.getLastModified();
> +         @SuppressWarnings("unchecked") StorageMetadata storageMetadata = 
> new StorageMetadataImpl(storageType, null,
> +                 joyentObject.getName(), null, null, joyentObject.getEtag(), 
> creationDate, creationDate,
> +                 Collections.EMPTY_MAP);
> +         storageMetadatas.add(storageMetadata);
> +      }

If you encapsulate the transformation in a `Function<JoyentObject, 
StorageMetadata>`, you can remove the loop and take advantage of the Guava's 
lazy iterators and lazy transformations, to transform only the elements that 
are actually read.
```java
return new PageSetImpl<StorageMetadata>(Iterables.transform(form, 
transformationFunction), null);
```

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

Reply via email to