HashMap已经实现了Map接口,LinkedHashMap既然继承了HashMap,为什么还要implements一遍,是为了保留自己跟父类HashMap中Map方法不一样的可能性吗?如果是,那为什么不直接重写,还要再继承呢?
附:LinkedHashMap源代码
public class LinkedHashMap<K,V> extends HashMap<K,V> implements Map<K,V> {
/*
省略内部代码
*/
}
拉丁的传说
Cats萌萌
泛舟湖上清波郎朗
为什么要实现Aware接口
为什么ArrayList继承了AbstractList还要实现List接口
接口继承接口也需要实现吗?
Set不是接口么,不需要用实现类么?为什么直接可以Set keySet =....
相关分类