1: public V remove(K key)
2: {
3: checkInitialization();
4: V result = null;
5: int keyIndex = locateIndex(key);
6: if (keyIndex < numberOfEntries)
7: {
8: // Key found; remove entry and return its value
9: result = dictionary[keyIndex].getValue();
10: dictionary[keyIndex] = dictionary[numberOfEntries - 1];
11: dictionary[numberOfEntries - 1] = null;
12: numberOfEntries--;
13: } // end if
14: // Else result is null
15: return result;
16: } // end remove
17: // Version 4.0