Looking at the JDK source code for LinkedHashMap, I noticed that this class is declared as:
public class LinkedHashMap<K,V>
extends HashMap<K,V>
implements Map<K,V>
{...
why the redundant “implements Map<K,V>” (since HashMap already implements Map) ? I cannot imagine this is a typo…
Thanks.
I suppose it’s a way of saying
If someone responsible for the HashMap decides that it should no longer implement the Map interface, the compiler will warn the maintainer of LinkedHashMap that it no longer implements the Map interface as he intended.
Of course it’s silly in this particular case (HashMap will obviously always be a Map), but similar situations may benefit from (and have given rise to) such convention.