@return a new DotAttributes with attributed in given input added.
(String... input)
| 93 | * @return a new {@link DotAttributes} with attributed in given input added. |
| 94 | */ |
| 95 | public DotAttributes add(String... input) { |
| 96 | if ((input.length & 1) != 0) { // implicit nullcheck of input |
| 97 | throw new IllegalArgumentException("input.length should be even"); |
| 98 | } |
| 99 | MultiMap<String, String> newAttrs = Maps.newMultiMap(); |
| 100 | newAttrs.putAll(attrs); |
| 101 | for (int i = 0; i < input.length; i += 2) { |
| 102 | newAttrs.put(input[i], input[i + 1]); |
| 103 | } |
| 104 | return new DotAttributes(newAttrs); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @return a {@link DotAttributes} containing attributes specified by input. |
no test coverage detected