> +public class MachineTypeInZoneToHardware implements
> Function<MachineTypeInZone, Hardware> {
> +
> + private final Supplier<Map<URI, ? extends Location>> locations;
> +
> + @Inject
> + public MachineTypeInZoneToHardware(@Memoized Supplier<Map<URI, ? extends
> Location>> locations) {
> + this.locations = locations;
> + }
> + @Override
> + public Hardware apply(final MachineTypeInZone input) {
> + Location location =
> checkNotNull(getOnlyElement(filter(locations.get().values(), new
> Predicate<Location>() {
> + @Override
> + public boolean apply(Location l) {
> + return l.getId().equals(input.getMachineType().getZone());
> + }
> + })), "location for %s", input.getMachineType().getZone());
Break into two statements?
```
Iterable<...> locations = filter(...)
Location location = checkNotNull(getOnlyElement(locations), ...)
```
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/16/files#r5362335