> +      private String distribution;
> +
> +      public Builder from(String name, String distribution) {
> +         this.name = checkNotNull(name, "name cannot be null");
> +         this.distribution = checkNotNull(distribution, "distribution cannot 
> be null");
> +         return this;
> +      }
> +
> +      public OperatingSystem build() {
> +         return new OperatingSystem(distribution, match(VERSION_PATTERN, 
> name, 1), match(ARCH_PATTERN, name, 0));
> +      }
> +   }
> +
> +   private static String match(final Pattern pattern, final String input, 
> int group) {
> +      Matcher m = pattern.matcher(input);
> +      return m.find() ? nullToEmpty(m.group(group)) : "";

Or (but up to you)
```
return nullToEmpty(m.find() ? m.group(group) : null);
```

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

Reply via email to