Maps the specified key to the specified value. @param key the key. @param value the value. @return the value of any previous mapping with the specified key or null if there was no such mapping.
(K key, V value)
| 364 | * {@code null} if there was no such mapping. |
| 365 | */ |
| 366 | @Override |
| 367 | public V put(K key, V value) { |
| 368 | V result = putImpl(key, value); |
| 369 | |
| 370 | if (removeEldestEntry(head)) { |
| 371 | remove(head.key); |
| 372 | } |
| 373 | |
| 374 | return result; |
| 375 | } |
| 376 | |
| 377 | V putImpl(K key, V value) { |
| 378 | LinkedHashMapEntry<K, V> m; |