--- old/src/share/classes/java/util/LinkedHashMap.java 2013-12-16 19:35:02.508071711 -0800 +++ new/src/share/classes/java/util/LinkedHashMap.java 2013-12-16 19:35:02.360071704 -0800 @@ -28,7 +28,6 @@ import java.util.function.Consumer; import java.util.function.BiConsumer; import java.util.function.BiFunction; -import java.io.Serializable; import java.io.IOException; /** @@ -63,14 +62,17 @@ * provided to create a linked hash map whose order of iteration is the order * in which its entries were last accessed, from least-recently accessed to * most-recently (access-order). This kind of map is well-suited to - * building LRU caches. Invoking the put or get method - * results in an access to the corresponding entry (assuming it exists after - * the invocation completes). The putAll method generates one entry - * access for each mapping in the specified map, in the order that key-value - * mappings are provided by the specified map's entry set iterator. No - * other methods generate entry accesses. In particular, operations on - * collection-views do not affect the order of iteration of the backing - * map. + * building LRU caches. Invoking the {@code put}, {@code putIfAbsent}, + * {@code get}, {@code getOrDefault}, {@code compute}, {@code computeIfAbsent}, + * {@code computeIfPresent}, or {@code merge} methods results + * in an access to the corresponding entry (assuming it exists after the + * invocation completes). The {@code replace} method only results in an access + * of the entry if the value is replaced. The {@code putAll} method generates one + * entry access for each mapping in the specified map, in the order that + * key-value mappings are provided by the specified map's entry set iterator. + * No other methods generate entry accesses. In particular, operations + * on collection-views do not affect the order of iteration of the + * backing map. * *
The {@link #removeEldestEntry(Map.Entry)} method may be overridden to * impose a policy for removing stale mappings automatically when new mappings @@ -112,8 +114,8 @@ * iteration order. In insertion-ordered linked hash maps, merely changing * the value associated with a key that is already contained in the map is not * a structural modification. In access-ordered linked hash maps, - * merely querying the map with get is a structural - * modification.) + * merely querying the map with get is a structural modification. + * ) * *
The iterators returned by the iterator method of the collections
* returned by all of this class's collection view methods are
@@ -443,8 +445,19 @@
}
/**
- * Removes all of the mappings from this map.
- * The map will be empty after this call returns.
+ * {@inheritDoc}
+ */
+ public V getOrDefault(Object key, V defaultValue) {
+ Node