don't null out array in HashMap when size drops to zero

As in ArrayList, we want to avoid thrashing in cases where the map is frequently emptied and refilled.
This commit is contained in:
Joel Dice 2009-11-19 12:55:53 -07:00
parent adcac443e4
commit 6475beda83

View File

@ -66,8 +66,6 @@ public class HashMap<K, V> implements Map<K, V> {
private void shrink() {
if (array.length / 2 >= MinimumCapacity && size <= array.length / 3) {
resize(array.length / 2);
} else if (size == 0) {
resize(0);
}
}