public void Delete(K key)
        {
            Keyed <K, V> pointer  = this.first;
            Keyed <K, V> previous = null;

            if (pointer == null)
            {
                return;
            }
            while (!pointer.Key().Equals(key))
            {
                previous = pointer;
                pointer  = pointer.Next();
                if (pointer == null)
                {
                    return;
                }
            }
            if (previous == null)
            {
                this.first = this.first.Next();
            }
            else
            {
                previous.Next(pointer.Next());
            }
        }
        public V Get(K key)
        {
            Keyed <K, V> pointer = this.first;

            if (pointer == null)
            {
                return(default(V));
            }
            while (!pointer.Key().Equals(key))
            {
                pointer = pointer.Next();
                if (pointer == null)
                {
                    return(default(V));
                }
            }
            return(pointer.Value());
        }
Example #3
0
 public void Next(Keyed <K, V> next)
 {
     this.next = next;
 }
        public void Push(K key, V value)
        {
            Keyed <K, V> newFirst = new Keyed <K, V>(value, key, this.first);

            this.first = newFirst;
        }
Example #5
0
 public Keyed(V value, K key, Keyed <K, V> next)
 {
     this.value = value;
     this.key   = key;
     this.next  = next;
 }