Index: mojo/public/cpp/bindings/map.h |
diff --git a/mojo/public/cpp/bindings/map.h b/mojo/public/cpp/bindings/map.h |
index 0ee66fb46b8f9ce8b550b6bb2a452a580a4e9034..f09937a40046c98e9b5f2f1cb5e684191957af6b 100644 |
--- a/mojo/public/cpp/bindings/map.h |
+++ b/mojo/public/cpp/bindings/map.h |
@@ -117,6 +117,24 @@ class Map { |
return result.Pass(); |
} |
+ bool Equals(const Map& other) const { |
+ if (is_null() != other.is_null()) |
+ return false; |
+ if (size() != other.size()) |
+ return false; |
+ auto i = begin(); |
+ auto j = other.begin(); |
+ while (i != end()) { |
+ if (i.GetKey() != j.GetKey()) |
+ return false; |
+ if (!internal::ValueTraits<Value>::Equals(i.GetValue(), j.GetValue())) |
+ return false; |
+ ++i; |
+ ++j; |
+ } |
+ return true; |
+ } |
+ |
class ConstMapIterator { |
public: |
ConstMapIterator( |