557 |
|
|
558 |
|
/** |
559 |
|
* Creates a new, empty map with the specified initial |
560 |
< |
* capacity, load factor, and concurrency level. |
560 |
> |
* capacity and the specified load factor. |
561 |
|
* |
562 |
|
* @param initialCapacity the initial capacity. The implementation |
563 |
|
* performs internal sizing to accommodate this many elements. |
564 |
|
* @param loadFactor the load factor threshold, used to control resizing. |
565 |
– |
* Resizing may be performed when the average number of elements per |
566 |
– |
* bin exceeds this threshold. |
565 |
|
* @param concurrencyLevel the estimated number of concurrently |
566 |
|
* updating threads. The implementation performs internal sizing |
567 |
|
* to try to accommodate this many threads. |
603 |
|
|
604 |
|
/** |
605 |
|
* Creates a new, empty map with the specified initial |
606 |
< |
* capacity, and with default load factor (<tt>0.75f</tt>) |
609 |
< |
* and concurrencyLevel (<tt>16</tt>). |
606 |
> |
* capacity, and with default load factor and concurrencyLevel. |
607 |
|
* |
608 |
< |
* @param initialCapacity the initial capacity. The implementation |
609 |
< |
* performs internal sizing to accommodate this many elements. |
608 |
> |
* @param initialCapacity The implementation performs internal |
609 |
> |
* sizing to accommodate this many elements. |
610 |
|
* @throws IllegalArgumentException if the initial capacity of |
611 |
|
* elements is negative. |
612 |
|
*/ |
615 |
|
} |
616 |
|
|
617 |
|
/** |
618 |
< |
* Creates a new, empty map with a default initial capacity |
619 |
< |
* (<tt>16</tt>), load factor (<tt>0.75f</tt>) and |
623 |
< |
* concurrencyLevel (<tt>16</tt>). |
618 |
> |
* Creates a new, empty map with a default initial capacity, |
619 |
> |
* load factor, and concurrencyLevel. |
620 |
|
*/ |
621 |
|
public ConcurrentHashMap() { |
622 |
|
this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); |
624 |
|
|
625 |
|
/** |
626 |
|
* Creates a new map with the same mappings as the given map. The |
627 |
< |
* map is created with a capacity consistent with the default load |
628 |
< |
* factor (<tt>0.75f</tt>) and uses the default concurrencyLevel |
629 |
< |
* (<tt>16</tt>). |
627 |
> |
* map is created with a capacity of twice the number of mappings in |
628 |
> |
* the given map or 11 (whichever is greater), and a default load factor |
629 |
> |
* and concurrencyLevel. |
630 |
|
* @param t the map |
631 |
|
*/ |
632 |
|
public ConcurrentHashMap(Map<? extends K, ? extends V> t) { |
633 |
|
this(Math.max((int) (t.size() / DEFAULT_LOAD_FACTOR) + 1, |
634 |
< |
DEFAULT_INITIAL_CAPACITY), |
634 |
> |
11), |
635 |
|
DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); |
636 |
|
putAll(t); |
637 |
|
} |