//TODO FIX THIS MONSTROSITY public TValue this[TKey key] { get { if (!Tree.Contains(new ComparableKeyValuePair <TKey, TValue>(key, default(TValue)))) { throw new KeyNotFoundException(); } var pair = Tree.Find(new ComparableKeyValuePair <TKey, TValue>(key, default(TValue))); return(pair.Value); } set { var defaultItem = new ComparableKeyValuePair <TKey, TValue>(key, value); if (!Tree.Contains(defaultItem)) { Tree.Insert(defaultItem); } else { var node = Tree.Find(defaultItem); node.Value = value; } } }
public int CompareTo(ComparableKeyValuePair <TKey, TValue> other) { return(Key.CompareTo(other.Key)); }
public bool ContainsKey(TKey key) { var defaultItem = new ComparableKeyValuePair <TKey, TValue>(key, default(TValue)); return(Tree.Contains(defaultItem)); }