> +import com.google.common.collect.Range;
> +import com.google.common.collect.Sets;
> +
> +public class NetworkFirewallPredicates {
> +
> +   public static Predicate<Firewall> hasProtocol(final IpProtocol protocol) {
> +      return new Predicate<Firewall>() {
> +
> +         @Override
> +         public boolean apply(Firewall fw) {
> +            return Predicates.in(transform(fw.getAllowed(), new 
> Function<Rule, IpProtocol>() {
> +               @Override
> +               public IpProtocol apply(Rule input) {
> +                  return input.getIpProtocol();
> +               }
> +            })).apply(protocol);

At the risk of being boring and old skool...
```
public boolean apply(Firewall fw) {
  for (Rule rule : fw.getAllowed()) {
    if (rule.getIpProtocol().equals(protocol)) {
      return true;
    }
  }
  return false;
}
```
?

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

Reply via email to