Ejemplo n.º 1
0
        private HashNodeMap <TValue> CreateNode(TKey key, TValue value)
        {
            int hashCode = key.GetHashCode();
            HashNodeMap <TValue> newNodeMap = new HashNodeMap <TValue>
            {
                data = new Node <TValue>(value),
                key  = hashCode
            };

            return(newNodeMap);
        }
Ejemplo n.º 2
0
 public void Add(TKey key, TValue value)
 {
     if (hashNode == null)
     {
         hashNode = CreateNode(key, value);
     }
     else
     {
         HashNodeMap <TValue> current = hashNode;
         while (current.next != null)
         {
             current = current.next;
         }
         current.next = CreateNode(key, value);
     }
     Count++;
 }