Returns true if the given object is also a Attributes with an equal attribute values. Note that if a stored values are mutable, it is possible for two objects to be considered equal at one point in time and not equal at another (due to concurrent mutation of attribute values). This m
(Object o)
| 171 | * @return true if the given object is a {@link Attributes} equal attributes. |
| 172 | */ |
| 173 | @Override |
| 174 | public boolean equals(Object o) { |
| 175 | if (this == o) { |
| 176 | return true; |
| 177 | } |
| 178 | if (o == null || getClass() != o.getClass()) { |
| 179 | return false; |
| 180 | } |
| 181 | Attributes that = (Attributes) o; |
| 182 | if (data.size() != that.data.size()) { |
| 183 | return false; |
| 184 | } |
| 185 | for (Map.Entry<Key<?>, Object> e : data.entrySet()) { |
| 186 | if (!that.data.containsKey(e.getKey())) { |
| 187 | return false; |
| 188 | } |
| 189 | if (!Objects.equal(e.getValue(), that.data.get(e.getKey()))) { |
| 190 | return false; |
| 191 | } |
| 192 | } |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Returns a hash code for the attributes. |