Copies all of the mappings from the specified map to this map. These mappings replace any mappings that this map had for any of the keys currently in the specified map. @param map Mappings to be stored in this map. @throws ClassCastException class of a key or value in the specified m
(Map<? extends K, ? extends V> map)
| 307 | * keys and a specified key is <tt>null</tt>. |
| 308 | */ |
| 309 | @Override |
| 310 | public void putAll(Map<? extends K, ? extends V> map) { |
| 311 | int mapSize = map.size(); |
| 312 | if (size==0 && mapSize!=0 && map instanceof SortedMap) { |
| 313 | @SuppressWarnings("unchecked") |
| 314 | Comparator<? super K> c = ((SortedMap<K,V>)map).comparator(); |
| 315 | if (c == comparator || (c != null && c.equals(comparator))) { |
| 316 | ++modCount; |
| 317 | try { |
| 318 | buildFromSorted(mapSize, map.entrySet().iterator(), |
| 319 | null, null); |
| 320 | } catch (java.io.IOException cannotHappen) { |
| 321 | } catch (ClassNotFoundException cannotHappen) { |
| 322 | } |
| 323 | return; |
| 324 | } |
| 325 | } |
| 326 | super.putAll(map); |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * Returns this map's entry for the given key, or <tt>null</tt> if the map |
no test coverage detected