Returns a shallow copy of this map. @return a shallow copy of this map.
()
| 365 | * @return a shallow copy of this map. |
| 366 | */ |
| 367 | @Override |
| 368 | @SuppressWarnings("unchecked") |
| 369 | public Object clone() { |
| 370 | try { |
| 371 | HashMap<K, V> map = (HashMap<K, V>) super.clone(); |
| 372 | map.elementCount = 0; |
| 373 | map.elementData = newElementArray(elementData.length); |
| 374 | map.putAll(this); |
| 375 | |
| 376 | return map; |
| 377 | } catch (CloneNotSupportedException e) { |
| 378 | return null; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Computes the threshold for rehashing |
no test coverage detected