Java – why does the LinkedHashMap class implement the map interface?
See English answers > Why do many collection classes in Java extend the abstract class and implement the interface as well? 10
public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>,Cloneable,Serializable
The LinkedHashMap class extends HashMap, which means that it should implement the map interface by default Why explicitly implement the map interface?
public class LinkedHashMap<K,V> extends HashMap<K,V>
Solution
You're right: discarding the map < < K, V > declaration from the link hash map won't change anything Although LinkedHashMap < K, V > will implement Map < K, V > only because it extends HashMap < K, the fact that link hash mapping derives from conventional hash mapping is implementation details, not mandatory requirements
On the other hand, the interface is a basic requirement If the designer decides to implement LinkedHashMap < K, this requirement will not disappear Start from scratch, or rely on other base classes, such as linked lists
This is why the designer of LinkedHashMap < K, V > mentioned map < K, V > and made it clear that if the base class will change due to redesign at a later time, the interface will remain unchanged