523 |
|
|
524 |
|
/** |
525 |
|
* Constructs a new, empty map with a default initial capacity, |
526 |
< |
* load factor, and number of segments |
526 |
> |
* load factor, and number of segments. |
527 |
|
*/ |
528 |
|
public ConcurrentHashMap() { |
529 |
|
this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); |
730 |
|
* @throws NullPointerException if the key is |
731 |
|
* <code>null</code>. |
732 |
|
*/ |
733 |
< |
public V remove(Object key, Object value) { |
733 |
> |
public boolean remove(Object key, Object value) { |
734 |
|
int hash = hash(key); |
735 |
< |
return segmentFor(hash).remove(key, hash, value); |
735 |
> |
return segmentFor(hash).remove(key, hash, value) != null; |
736 |
|
} |
737 |
|
|
738 |
|
/** |
772 |
|
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and |
773 |
|
* <tt>clear</tt> operations. It does not support the <tt>add</tt> or |
774 |
|
* <tt>addAll</tt> operations. |
775 |
+ |
* The returned <tt>iterator</tt> is a "weakly consistent" iterator that |
776 |
+ |
* will never throw {@link java.util.ConcurrentModificationException}, |
777 |
+ |
* and guarantees to traverse elements as they existed upon |
778 |
+ |
* construction of the iterator, and may (but is not guaranteed to) |
779 |
+ |
* reflect any modifications subsequent to construction. |
780 |
|
* |
781 |
|
* @return a set view of the keys contained in this map. |
782 |
|
*/ |
794 |
|
* <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>, |
795 |
|
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> operations. |
796 |
|
* It does not support the <tt>add</tt> or <tt>addAll</tt> operations. |
797 |
+ |
* The returned <tt>iterator</tt> is a "weakly consistent" iterator that |
798 |
+ |
* will never throw {@link java.util.ConcurrentModificationException}, |
799 |
+ |
* and guarantees to traverse elements as they existed upon |
800 |
+ |
* construction of the iterator, and may (but is not guaranteed to) |
801 |
+ |
* reflect any modifications subsequent to construction. |
802 |
|
* |
803 |
|
* @return a collection view of the values contained in this map. |
804 |
|
*/ |
817 |
|
* <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>, |
818 |
|
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> operations. |
819 |
|
* It does not support the <tt>add</tt> or <tt>addAll</tt> operations. |
820 |
+ |
* The returned <tt>iterator</tt> is a "weakly consistent" iterator that |
821 |
+ |
* will never throw {@link java.util.ConcurrentModificationException}, |
822 |
+ |
* and guarantees to traverse elements as they existed upon |
823 |
+ |
* construction of the iterator, and may (but is not guaranteed to) |
824 |
+ |
* reflect any modifications subsequent to construction. |
825 |
|
* |
826 |
|
* @return a collection view of the mappings contained in this map. |
827 |
|
*/ |
979 |
|
if (!(o instanceof Map.Entry)) |
980 |
|
return false; |
981 |
|
Map.Entry<K,V> e = (Map.Entry<K,V>)o; |
982 |
< |
return ConcurrentHashMap.this.remove(e.getKey(), e.getValue()) != null; |
982 |
> |
return ConcurrentHashMap.this.remove(e.getKey(), e.getValue()); |
983 |
|
} |
984 |
|
public int size() { |
985 |
|
return ConcurrentHashMap.this.size(); |