Warum verwendet IdentityHasMap 2/3 als Lastfaktor anstelle von 0,75?Java

Java-Forum
Anonymous
 Warum verwendet IdentityHasMap 2/3 als Lastfaktor anstelle von 0,75?

Post by Anonymous »

Code: Select all

public class IdentityHashMap
extends AbstractMap
implements Map, 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
}
Von jdk/identityHasMap.java at jdk8-b120 · openjdk/jdk · github
update update
Ich fand auch, dass ThreadLocal.Theadlocalmap Auch als Lastfaktor verwendet wird. Konflikte.

Code: Select all

/**
* Set the resize threshold to maintain at worst a 2/3 load factor.
*/
private void setThreshold(int len) {
threshold = len * 2 / 3;
}
von jdk/threadLocal.java unter jdk8-b120 · openjdk/jdk · github

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post