85 |
|
* finding such an entry, <tt>false</tt> is returned. Note that this |
86 |
|
* implementation requires linear time in the size of the map. |
87 |
|
* |
88 |
– |
* @throws NullPointerException {@inheritDoc} |
88 |
|
* @throws ClassCastException {@inheritDoc} |
89 |
+ |
* @throws NullPointerException {@inheritDoc} |
90 |
|
*/ |
91 |
|
public boolean containsValue(Object value) { |
92 |
|
Iterator<Entry<K,V>> i = entrySet().iterator(); |
116 |
|
* implementation requires linear time in the size of the map; many |
117 |
|
* implementations will override this method. |
118 |
|
* |
119 |
– |
* @throws NullPointerException {@inheritDoc} |
119 |
|
* @throws ClassCastException {@inheritDoc} |
120 |
+ |
* @throws NullPointerException {@inheritDoc} |
121 |
|
*/ |
122 |
|
public boolean containsKey(Object key) { |
123 |
|
Iterator<Map.Entry<K,V>> i = entrySet().iterator(); |
147 |
|
* implementation requires linear time in the size of the map; many |
148 |
|
* implementations will override this method. |
149 |
|
* |
150 |
– |
* @throws NullPointerException {@inheritDoc} |
150 |
|
* @throws ClassCastException {@inheritDoc} |
151 |
+ |
* @throws NullPointerException {@inheritDoc} |
152 |
|
*/ |
153 |
|
public V get(Object key) { |
154 |
|
Iterator<Entry<K,V>> i = entrySet().iterator(); |
178 |
|
* <tt>UnsupportedOperationException</tt>. |
179 |
|
* |
180 |
|
* @throws UnsupportedOperationException {@inheritDoc} |
181 |
– |
* @throws NullPointerException {@inheritDoc} |
181 |
|
* @throws ClassCastException {@inheritDoc} |
182 |
+ |
* @throws NullPointerException {@inheritDoc} |
183 |
|
* @throws IllegalArgumentException {@inheritDoc} |
184 |
|
*/ |
185 |
|
public V put(K key, V value) { |
204 |
|
* contains a mapping for the specified key. |
205 |
|
* |
206 |
|
* @throws UnsupportedOperationException {@inheritDoc} |
207 |
– |
* @throws NullPointerException {@inheritDoc} |
207 |
|
* @throws ClassCastException {@inheritDoc} |
208 |
+ |
* @throws NullPointerException {@inheritDoc} |
209 |
|
*/ |
210 |
|
public V remove(Object key) { |
211 |
|
Iterator<Entry<K,V>> i = entrySet().iterator(); |
247 |
|
* the <tt>put</tt> operation and the specified map is nonempty. |
248 |
|
* |
249 |
|
* @throws UnsupportedOperationException {@inheritDoc} |
250 |
– |
* @throws NullPointerException {@inheritDoc} |
250 |
|
* @throws ClassCastException {@inheritDoc} |
251 |
+ |
* @throws NullPointerException {@inheritDoc} |
252 |
|
* @throws IllegalArgumentException {@inheritDoc} |
253 |
|
*/ |
254 |
|
public void putAll(Map<? extends K, ? extends V> m) { |
468 |
|
* appended. Finally a right brace is appended. A string is obtained |
469 |
|
* from the stringbuffer, and returned. |
470 |
|
* |
471 |
< |
* @return a String representation of this map. |
471 |
> |
* @return a String representation of this map |
472 |
|
*/ |
473 |
|
public String toString() { |
474 |
< |
StringBuffer buf = new StringBuffer(); |
475 |
< |
buf.append("{"); |
474 |
> |
StringBuilder sb = new StringBuilder(); |
475 |
> |
sb.append("{"); |
476 |
|
|
477 |
|
Iterator<Entry<K,V>> i = entrySet().iterator(); |
478 |
|
boolean hasNext = i.hasNext(); |
481 |
|
K key = e.getKey(); |
482 |
|
V value = e.getValue(); |
483 |
|
if (key == this) |
484 |
< |
buf.append("(this Map)"); |
484 |
> |
sb.append("(this Map)"); |
485 |
|
else |
486 |
< |
buf.append(key); |
487 |
< |
buf.append("="); |
486 |
> |
sb.append(key); |
487 |
> |
sb.append("="); |
488 |
|
if (value == this) |
489 |
< |
buf.append("(this Map)"); |
489 |
> |
sb.append("(this Map)"); |
490 |
|
else |
491 |
< |
buf.append(value); |
491 |
> |
sb.append(value); |
492 |
|
hasNext = i.hasNext(); |
493 |
|
if (hasNext) |
494 |
< |
buf.append(", "); |
494 |
> |
sb.append(", "); |
495 |
|
} |
496 |
|
|
497 |
< |
buf.append("}"); |
498 |
< |
return buf.toString(); |
497 |
> |
sb.append("}"); |
498 |
> |
return sb.toString(); |
499 |
|
} |
500 |
|
|
501 |
|
/** |
555 |
|
* Creates an entry representing the same mapping as the |
556 |
|
* specified entry. |
557 |
|
* |
558 |
< |
* @param entry the entry to copy. |
558 |
> |
* @param entry the entry to copy |
559 |
|
*/ |
560 |
|
public SimpleEntry(Entry<? extends K, ? extends V> entry) { |
561 |
|
this.key = entry.getKey(); |