前言

之前看源码一直忽略了这个现象,按理说HashMap的父类AbstractMap已经实现了Map,它为什么还要实现一次呢?遂上网查了一下,背后原因让人大跌眼镜。

原因

这是类库设计者的拼写错误,其实HashMap不应实现Map的。其他容器如List、Set也有这个问题。

参考

为什么HashMap继承了AbstractMap还要实现Map接口
Why does LinkedHashSet extend HashSet and implement Set

相关文章:

  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-27
  • 2021-09-07
  • 2021-06-17
  • 2022-12-23
  • 2021-04-06
  • 2021-07-13
  • 2021-06-19
相关资源
相似解决方案