Пример #1
0
        public void add(K key, V val)
        {
            Console.WriteLine("Podaj klucz i wartość: ");

            if (next != null)
            {
                next.add(key, val);
            }
            else
            {
                next     = new slownik <K, V>();
                next.key = key;
                next.val = val;
            }
        }
Пример #2
0
 public void delete(K key)
 {
     if (key.CompareTo(next.key) == 0)
     {
         Console.WriteLine("element usuwany - {0}", next.key);
         next = next.next;
     }
     else
     {
         if (next != null)
         {
             next.delete(key);
         }
     }
 }
Пример #3
0
        public V find(K key)
        {
            slownik <K, V> current = this;

            while (!key.Equals(current.key))
            {
                current = current.next;

                if (current == null)
                {
                    Console.WriteLine("Nie znaleziono podanego klucza {0} w słowniku.", key);
                    return(default(V));
                }
            }

            Console.Write("Wartość dla klucza {0} wynosi: ", current.key);
            return(current.val);
        }
Пример #4
0
 public slownik()
 {
     next = null;
     key  = default(K);
     val  = default(V);
 }