| 164 | } |
| 165 | |
| 166 | public Cell<K, V> removeCell(Object key) { |
| 167 | Cell<K, V> old = null; |
| 168 | if (array != null) { |
| 169 | int index = helper.hash(key) & (array.length - 1); |
| 170 | Cell<K, V> p = null; |
| 171 | for (Cell<K, V> c = array[index]; c != null; c = c.next()) { |
| 172 | if (helper.equal(key, c.getKey())) { |
| 173 | old = c; |
| 174 | if (p == null) { |
| 175 | array[index] = c.next(); |
| 176 | } else { |
| 177 | p.setNext(c.next()); |
| 178 | } |
| 179 | -- size; |
| 180 | break; |
| 181 | } |
| 182 | p = c; |
| 183 | } |
| 184 | |
| 185 | shrink(); |
| 186 | } |
| 187 | return old; |
| 188 | } |
| 189 | |
| 190 | public V put(K key, V value) { |
| 191 | Cell<K, V> c = find(key); |