MCPcopy Create free account
hub / github.com/ReadyTalk/avian / removeCell

Method removeCell

classpath/java/util/HashMap.java:166–188  ·  view source on GitHub ↗
(Object key)

Source from the content-addressed store, hash-verified

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);

Callers 2

removeMethod · 0.95
removeMethod · 0.45

Calls 6

shrinkMethod · 0.95
hashMethod · 0.65
nextMethod · 0.65
equalMethod · 0.65
getKeyMethod · 0.65
setNextMethod · 0.65

Tested by

no test coverage detected