public bool Contains(Object o) { if (!(o is HashMapEntry <K, V>)) { return(false); } HashMapEntry <K, V> e = (HashMapEntry <K, V>)o; IHashMapEntry <K, V> candidate = _map.GetEntry(e.Key); return(candidate != null && candidate.Equals(e)); }
/// <summary> /// remove the mapping for a specified entry /// </summary> /// <param name="o"></param> /// <returns></returns> public IHashMapEntry <K, V> RemoveMapping(object o) { if (!(o is HashMapEntry <K, V>)) { return(null); } HashMapEntry <K, V> entry = (HashMapEntry <K, V>)o; //object k = maskNull(entry.Key); int thehash = hash(entry.Key); int i = indexFor(thehash, table.Length); IHashMapEntry <K, V> prev = table[i]; IHashMapEntry <K, V> e = prev; while (e != null) { IHashMapEntry <K, V> next = e.Next; if (e.Hash == thehash && e.Equals(entry)) { modCount++; size--; if (prev == e) { table[i] = next; } else { prev.Next = next; } return(e); } prev = e; e = next; } return(e); }