public bool Contains(Object o) { if (!(o is HashMapEntry)) { return(false); } HashMapEntry e = (HashMapEntry)o; HashMapEntry 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 HashMapEntry RemoveMapping(object o) { if (!(o is HashMapEntry)) { return(null); } HashMapEntry entry = (HashMapEntry)o; object k = maskNull(entry.Key); int thehash = hash(k); int i = indexFor(thehash, table.Length); HashMapEntry prev = table[i]; HashMapEntry e = prev; while (e != null) { HashMapEntry 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); }