Esempio n. 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;
            }
        }
Esempio n. 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);
         }
     }
 }
Esempio n. 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);
        }
Esempio n. 4
0
 public slownik()
 {
     next = null;
     key  = default(K);
     val  = default(V);
 }