aboutsummaryrefslogtreecommitdiff
path: root/Mammoth/Couscous/java/util/AbstractMap.cs
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-03-30 23:09:24 +0100
committerMichael Williamson <mike@zwobble.org>2017-04-01 16:15:41 +0100
commit5b174110627839214c1413255e1c6715ff7d0aab (patch)
tree3f2a97c071f82c0e44d9846a931f813474250764 /Mammoth/Couscous/java/util/AbstractMap.cs
parent99ed1b53f084322c06975a2183d812db5f257d34 (diff)
Update java-mammoth to 1.3.1
Diffstat (limited to 'Mammoth/Couscous/java/util/AbstractMap.cs')
-rw-r--r--Mammoth/Couscous/java/util/AbstractMap.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Mammoth/Couscous/java/util/AbstractMap.cs b/Mammoth/Couscous/java/util/AbstractMap.cs
new file mode 100644
index 0000000..f619267
--- /dev/null
+++ b/Mammoth/Couscous/java/util/AbstractMap.cs
@@ -0,0 +1,37 @@
+using System.Collections.Generic;
+using System.Linq;
+using Mammoth.Couscous.java.lang;
+
+namespace Mammoth.Couscous.java.util {
+ internal abstract class AbstractMap<TKey, TValue> : Map<TKey, TValue> {
+ public override bool Equals(object other) {
+ var otherMap = other as Map;
+ if (otherMap == null) {
+ return false;
+ } else {
+ return Equals(otherMap);
+ }
+ }
+
+ public bool Equals(Map other) {
+ var first = AsUntypedDictionary();
+ var second = other.AsUntypedDictionary();
+ return
+ first.Count == second.Count &&
+ first.Keys.Cast<object>().All(key => second.Contains(key) && first[key].Equals(second[key]));
+ }
+
+ public override int GetHashCode() {
+ throw new System.NotSupportedException();
+ }
+
+ public abstract void put(TKey key, TValue value);
+ public abstract bool containsKey(TKey key);
+ public abstract Set<Map__Entry<TKey, TValue>> entrySet();
+ public abstract Collection<TValue> values();
+
+ public abstract Optional<TValue> _lookup(TKey key);
+ public abstract System.Collections.Generic.IDictionary<TKey, TValue> AsDictionary();
+ public abstract System.Collections.IDictionary AsUntypedDictionary();
+ }
+}