> +            out.name(String.valueOf(element.getKey()));
> +            valueAdapter.write(out, element.getValue());
> +         }
> +         out.endObject();
> +      }
> +
> +      public Map<K, V> read(JsonReader in) throws IOException {
> +         Map<K, V> result = Maps.newHashMap();
> +         in.beginObject();
> +         while (in.hasNext()) {
> +            JsonReaderInternalAccess.INSTANCE.promoteNameToValue(in);
> +            K name = keyAdapter.read(in);
> +            V value = valueAdapter.read(in);
> +            if (value != null) {
> +               // If there are repeated keys, only keep the last one
> +               result.remove(name);

Sure. It was just legacy because in a previous iteration the `result` variable 
was an `ImmutableMap.builder` which allowed multiple puts with the same key, 
failing in the build() method. Will remove this.

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

Reply via email to