public void Add(K key, V value) { int position = GetArrayPosition(key); LinkedList <keyPair <K, V> > linkedList = GetLinkedList(position); keyPair <K, V> item = new keyPair <K, V>() { Key = key, Value = value }; linkedList.AddLast(item); }
public void Remove(K key) { int position = GetArrayPosition(key); LinkedList <keyPair <K, V> > linkedList = GetLinkedList(position); bool itemFound = false; keyPair <K, V> foundItem = default(keyPair <K, V>); foreach (keyPair <K, V> item in linkedList) { if (item.Key.Equals(key)) { itemFound = true; foundItem = item; } } if (itemFound) { linkedList.Remove(foundItem); } }