> - public Iterable<MachineType> listHardwareProfiles() {
> - return
> api.getMachineTypeApiForProject(userProject.get()).list().concat();
> + public Iterable<MachineTypeInZone> listHardwareProfiles() {
> + return FluentIterable.from(zones.get().values())
> + .transformAndConcat(new Function<Location,
> ImmutableSet<MachineType>>() {
> + @Override
> + public ImmutableSet<MachineType> apply(Location input) {
> + return
> api.getMachineTypeApiForProject(userProject.get()).listInZone(input.getId()).concat().toSet();
> + }
> + }).transform(new Function<MachineType, MachineTypeInZone>() {
> +
> + @Override
> + public MachineTypeInZone apply(MachineType arg0) {
> + return new MachineTypeInZone(arg0, arg0.getZone());
> + }
> + }).toSet();
Any urgent (performance or otherwise) need for FluentIterable here? Smells a
little like https://code.google.com/p/guava-libraries/wiki/FunctionalExplained
- what would the imperative version look like?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/16/files#r5362240