code: public Object put(Object key, Object value) {
          if (key == null) {
              throw new NullPointerException("Null key is not permitted");
          }
  
          // Makes sure the key is not already in the HashMap.
          Entry tab[] = mTable;
          int hash = System.identityHashCode(key);
          int index = (hash & 0x7FFFFFFF) % tab.length;
  
          for (Entry e = tab[index], prev = null; e != null; e = e.mNext) {
              Object entryKey = e.getKey();
  
              if (entryKey == null) {
                  // Clean up after a cleared Reference.
                  mModCount++;
                  if (prev != null) {
                      prev.mNext = e.mNext;
                  }
                  else {
                      tab[index] = e.mNext;
                  }
                  mCount--;
              }
              else if (e.mHash == hash && key == entryKey) {
                  Object old = e.mValue;
                  e.mValue = value;
                  return old;
              }
              else {
                  prev = e;
              }
          }
  
          mModCount++;
  
          if (mCount >= mThreshold) {
              // Cleanup the table if the threshold is exceeded.
              cleanup();
          }
  
          if (mCount >= mThreshold) {
              // Rehash the table if the threshold is still exceeded.
              rehash();
              tab = mTable;
              index = (hash & 0x7FFFFFFF) % tab.length;
          }
          
          // Creates the new entry.
          Entry e = new Entry(hash, key, value, tab[index]);
          tab[index] = e;
          mCount++;
          return null;
      }
docs: Associates the specified value with the specified key in this map.
  If the map previously contained a mapping for this key, the old
  value is replaced.
  
  @param key key with which the specified value is to be associated.
  @param value value to be associated with the specified key.
  @return previous value associated with specified key, or <tt>null</tt>
  if there was no mapping for key.  A <tt>null</tt> return can
  also indicate that the HashMap previously associated
  <tt>null</tt> with the specified key.