Prevent Duplicate Entry into HashTable C++
<p>I was wondering if i could get some help to prevent a duplicate entry into my hashtable:</p>

<pre><code>bool hashmap::put(const stock&amp; s, int&amp; usedIndex, int&amp; hashIndex, int&amp; symbolHash)
{
    hashIndex = this-&gt;hashStr( s.m_symbol ); // Get remainder, Insert at that index.
    symbolHash = (int&amp;)s.m_symbol;
    usedIndex = hashIndex;

    while ( hashTable[hashIndex].m_symbol != NULL ) // collision found
    {
     ++usedIndex %= maxSize; // if necessary wrap index around
     if ( hashTable[usedIndex].m_symbol == NULL )
     {
      hashTable[usedIndex] = s;
      return true;
     }
    }
    hashTable[hashIndex] = s; // insert if no collision 
    return true;

}
</code></pre>

<p>The paramater hashIndex uses a java algorithm to generate an appropriate index to insert into the table. The usedIndex paramater is where I insert into the table when a collision is found; symbolHash just gets the address of the name passed in. stock is a class object.</p>

<p>My question is just, how do i prevent a duplicate entry?</p>
