135 |
|
/* ---------------- Small Utilities -------------- */ |
136 |
|
|
137 |
|
/** |
138 |
< |
* Return a hash code for non-null Object x. |
138 |
> |
* Returns a hash code for non-null Object x. |
139 |
|
* Uses the same hash code spreader as most other java.util hash tables. |
140 |
|
* @param x the object serving as a key |
141 |
|
* @return the hash code |
150 |
|
} |
151 |
|
|
152 |
|
/** |
153 |
< |
* Return the segment that should be used for key with given hash |
153 |
> |
* Returns the segment that should be used for key with given hash |
154 |
> |
* @param hash the hash code for the key |
155 |
> |
* @return the segment |
156 |
|
*/ |
157 |
|
final Segment<K,V> segmentFor(int hash) { |
158 |
|
return (Segment<K,V>) segments[(hash >>> segmentShift) & segmentMask]; |
521 |
|
/* ---------------- Public operations -------------- */ |
522 |
|
|
523 |
|
/** |
524 |
< |
* Constructs a new, empty map with the specified initial |
524 |
> |
* Creates a new, empty map with the specified initial |
525 |
|
* capacity and the specified load factor. |
526 |
|
* |
527 |
|
* @param initialCapacity the initial capacity. The implementation |
567 |
|
} |
568 |
|
|
569 |
|
/** |
570 |
< |
* Constructs a new, empty map with the specified initial |
570 |
> |
* Creates a new, empty map with the specified initial |
571 |
|
* capacity, and with default load factor and concurrencyLevel. |
572 |
|
* |
573 |
|
* @param initialCapacity The implementation performs internal |
580 |
|
} |
581 |
|
|
582 |
|
/** |
583 |
< |
* Constructs a new, empty map with a default initial capacity, |
583 |
> |
* Creates a new, empty map with a default initial capacity, |
584 |
|
* load factor, and concurrencyLevel. |
585 |
|
*/ |
586 |
|
public ConcurrentHashMap() { |
588 |
|
} |
589 |
|
|
590 |
|
/** |
591 |
< |
* Constructs a new map with the same mappings as the given map. The |
591 |
> |
* Creates a new map with the same mappings as the given map. The |
592 |
|
* map is created with a capacity of twice the number of mappings in |
593 |
|
* the given map or 11 (whichever is greater), and a default load factor. |
594 |
|
* @param t the map |
757 |
|
/** |
758 |
|
* Maps the specified <tt>key</tt> to the specified |
759 |
|
* <tt>value</tt> in this table. Neither the key nor the |
760 |
< |
* value can be <tt>null</tt>. <p> |
760 |
> |
* value can be <tt>null</tt>. |
761 |
|
* |
762 |
< |
* The value can be retrieved by calling the <tt>get</tt> method |
762 |
> |
* <p> The value can be retrieved by calling the <tt>get</tt> method |
763 |
|
* with a key that is equal to the original key. |
764 |
|
* |
765 |
|
* @param key the table key. |