public class IdentityHashMap<K,V>
extends AbstractMap<K,V>
implements Map<K,V>, java.io.Serializable, Cloneable
{
/**
* The initial capacity used by the no-args constructor.
* MUST be a power of two. The value 32 corresponds to the
* (specified) expected maximum size of 21, given a load factor
* of 2/3.
*/
private static final int DEFAULT_CAPACITY = 32;
// omitted
}
From jdk/IdentityHashMap.java at jdk8-b120 · openjdk/jdk · GitHub
Update
I also found that ThreadLocal.ThreadLocalMap
also uses 2/3 as the load factor, It also uses linear probing to resolve conflicts.
/**
* Set the resize threshold to maintain at worst a 2/3 load factor.
*/
private void setThreshold(int len) {
threshold = len * 2 / 3;
}
From jdk/ThreadLocal.java at jdk8-b120 · openjdk/jdk · GitHub
IdentityHashMap
ever considered using the same load factor asHashMap
. If they did, shmosel’s conjecture is the most plausible.