557 |
|
|
558 |
|
/** |
559 |
|
* Creates a new, empty map with the specified initial |
560 |
< |
* capacity and the specified load factor. |
560 |
> |
* capacity, load factor, and concurrency level. |
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. |
567 |
|
* @param concurrencyLevel the estimated number of concurrently |
568 |
|
* updating threads. The implementation performs internal sizing |
569 |
|
* to try to accommodate this many threads. |
605 |
|
|
606 |
|
/** |
607 |
|
* Creates a new, empty map with the specified initial |
608 |
< |
* capacity, and with default load factor and concurrencyLevel. |
608 |
> |
* capacity, and with default load factor (<tt>0.75f</tt>) |
609 |
> |
* and concurrencyLevel (<tt>16</tt>). |
610 |
|
* |
611 |
< |
* @param initialCapacity The implementation performs internal |
612 |
< |
* sizing to accommodate this many elements. |
611 |
> |
* @param initialCapacity the initial capacity. The implementation |
612 |
> |
* performs internal sizing to accommodate this many elements. |
613 |
|
* @throws IllegalArgumentException if the initial capacity of |
614 |
|
* elements is negative. |
615 |
|
*/ |
618 |
|
} |
619 |
|
|
620 |
|
/** |
621 |
< |
* Creates a new, empty map with a default initial capacity, |
622 |
< |
* load factor, and concurrencyLevel. |
621 |
> |
* Creates a new, empty map with a default initial capacity |
622 |
> |
* (<tt>16</tt>), load factor (<tt>0.75f</tt>) and |
623 |
> |
* concurrencyLevel (<tt>16</tt>). |
624 |
|
*/ |
625 |
|
public ConcurrentHashMap() { |
626 |
|
this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); |
628 |
|
|
629 |
|
/** |
630 |
|
* Creates a new map with the same mappings as the given map. The |
631 |
< |
* map is created with a capacity of twice the number of mappings in |
632 |
< |
* the given map or 11 (whichever is greater), and a default load factor |
633 |
< |
* and concurrencyLevel. |
631 |
> |
* map is created with a capacity consistent with the default load |
632 |
> |
* factor (<tt>0.75f</tt>) and uses the default concurrencyLevel |
633 |
> |
* (<tt>16</tt>). |
634 |
|
* @param t the map |
635 |
|
*/ |
636 |
|
public ConcurrentHashMap(Map<? extends K, ? extends V> t) { |
637 |
|
this(Math.max((int) (t.size() / DEFAULT_LOAD_FACTOR) + 1, |
638 |
< |
11), |
638 |
> |
DEFAULT_INITIAL_CAPACITY), |
639 |
|
DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); |
640 |
|
putAll(t); |
641 |
|
} |