public string FindValue(string keyToSearch) { if (NonHashedKeys.Contains(keyToSearch)) { int valueIndex = NonHashedKeys.IndexOf(keyToSearch); return(Value[valueIndex]); } else { throw new ArgumentException("The given key doesn't exist."); } }
public void Remove(string k) { if (!NonHashedKeys.Contains(k)) { throw new ArgumentException("Key doesn't exist."); } else { int keyIndex = NonHashedKeys.IndexOf(k); NonHashedKeys.RemoveAt(keyIndex); Key.RemoveAt(keyIndex); Value.RemoveAt(keyIndex); } }
public void Insert(string k, string v) { if (NonHashedKeys.Contains(k)) { throw new ArgumentException("Key already exists."); } else { NonHashedKeys.Add(k); int keyHashed = Hash(k, Max); Key.Add(keyHashed); Value.Add(v); } }