Java. util. HashMap – why does HashMap extend abstractmap and implement it?

See English answers > Why do many collection classes in Java extend the abstract class and implement the interface as well? 8

Solution

This is superfluous. I suspect it's for "file" reasons HashMap implements map, which you can rely on The fact that it extends abstractmap can be said to be just an implementation detail (although future versions of HashMap will not extend abstractmap, because there may be some code to assign HashMap to abstractmap.)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>