hashkey collision when removing C++
<p>To make the search foreach "symbol" i want to remove from my hashTable, i have chosen to generate the hashkey i inserted it at. However, the problem that Im seeing in my remove function is when I need to remove a symbol from where a collision was found it previously results in my while loop condition testing false where i do not want. </p>

<pre><code>bool hashmap::get(char const * const symbol, stock&amp; s) const
{
    int hash = this-&gt;hashStr( symbol );
    while ( hashTable[hash].m_symbol != NULL )
    {     // try to find a match for the stock associated with the symbol.
     if ( strcmp( hashTable[hash].m_symbol , symbol ) == 0 )
     {
      s = &amp;hashTable[hash];
      return true;
     }
     ++hash %= maxSize;
    }
    return false;
}

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;
     }
     else if ( strcmp( hashTable[usedIndex].m_symbol , s.m_symbol ) == 0 )
     {
      return false; // prevent duplicate entry
     }
    }
    hashTable[hashIndex] = s; // insert if no collision 
    return true;
}
// What if I need to remove an index i generate?
bool hashmap::remove(char const * const symbol)
{
    int hashVal = this-&gt;hashStr( symbol );
    while ( hashTable[hashVal].m_symbol != NULL )
    {
     if ( strcmp( hashTable[hashVal].m_symbol, symbol ) == 0 )
     {
      stock temp = hashTable[hashVal]; // we cansave it
      hashTable[hashVal].m_symbol = NULL;
      return true;
     }
     ++hashVal %= maxSize; // wrap around if needed 
    }      // go to the next cell meaning their was a previous collision
    return false;
}

int hashmap::hashStr(char const * const str)
{   
    size_t length = strlen( str );
    int hash = 0;
    for ( unsigned i = 0; i &lt; length; i++ )
    {
     hash = 31 * hash + str[i];
    }
    return hash % maxSize;
}
</code></pre>

<p>What would I need to do to remove a "symbol" from my hashTable from a previous collision?
I am hoping it is not java's equation directly above. </p>
