Test LinkedHashMap.removeEldestEntry() implementation that modifies underlying map
The documentation for LinkedHashMap.removeEldestEntry() states: > <p>This method typically does not modify the map in any way, > instead allowing the map to modify itself as directed by its > return value. It <i>is</i> permitted for this method to modify > the map directly, but if it does so, it <i>must</i> return > <tt>false</tt> (indicating that the map should not attempt any > further modification). The effects of returning <tt>true</tt> > after modifying the map from within this method are unspecified. This CL adds a test coverage for the case when removeEldestEntry() modifies underlying map, such as: - Removing from map by key - Removing from map by both key and value - Removing from order-accessed map (rather than insertion-order) - Removing from map by other than passed eldest entry Bug: 71498231 Test: atest core-tests:libcore.java.util.LinkedHashMapTest Change-Id: I12ff2592b6c640c0d96c1d92d5d93d26b4e7cf21
Loading
Please sign in to comment