using System.Collections.Generic; using System.Linq; using Mammoth.Couscous.java.lang; namespace Mammoth.Couscous.java.util { internal abstract class AbstractMap : Map { 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().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 void putAll(Map other); public abstract bool containsKey(TKey key); public abstract Set> entrySet(); public abstract Collection values(); public abstract Optional _lookup(TKey key); public abstract System.Collections.Generic.IDictionary AsDictionary(); public abstract System.Collections.IDictionary AsUntypedDictionary(); } }