> +
> +   private Set<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) {
> +      if (virtualGuest.getVirtualGuestBlockDevices() == null) return null;
> +      Set<BlockDevice> set = 
> FluentIterable.from(virtualGuest.getVirtualGuestBlockDevices())
> +              .transform(new Function<VirtualGuestBlockDevice, 
> BlockDevice>() {
> +                 @Override
> +                 public BlockDevice apply(VirtualGuestBlockDevice input) {
> +                    return new BlockDevice(input.getDevice(), 
> input.getVirtualDiskImage().getCapacity());
> +                 }
> +              })
> +              .toSortedSet(new Comparator<BlockDevice>() {
> +                 @Override
> +                 public int compare(BlockDevice b1, BlockDevice b2) {
> +                    return 
> Integer.valueOf(b1.getDevice()).compareTo(Integer.valueOf(b2.getDevice()));
> +                 }
> +              });

Unless there's a really good reason to use Guava here, just write as:
```
ImmutableSortedSet.Builder<BlockDevice> blockDevices = 
ImmutableSortedSet.orderedBy(new Comparator...);
for (VirtualGuestBlockDevice blockDevice : 
virtualGuest.getVirtualGuestBlockDevices()) {
  blockDevices.add(new BlockDevice(input.getDevice(), 
input.getVirtualDiskImage().getCapacity());
}
return blockDevices.build();
```
It's just so much easier to read and understand ;-)

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

Reply via email to