AbstractList most likely implements a default behavior for methods defined in the List interface. Your classes like ArrayList, LinkedList, etc. that implement List also probably define a more specific implementation of the methods defined in List, so override the default provided by AbstractList.
Hi, Jason and Thomas, Thank you very much for giving me a reply. What I want to know is why Sun writes "implements List" again in LinkedList class? Is there any other reason than for convenience? One of my friends told me that it may improve the performance. If so, why LinkedList does not implement Collection interface again? If LinkedList wants to provide some specific implementation of List interface, it can override the functions directly and it need not write the "implements List" again. Nanchun
Joined: May 05, 2000
The general idea is that if a class extends a class that implements an interface, the the hierarchy of interfaces is not clearly evident. It makes it much easier to see if the interface is directly listed. It has nothing to do with performance.
Chicken Farmer ()
Joined: May 08, 2001
Nanchun- true, since the method is already there you can just override. I guess having the implements List there, even though it already implements it, is an easier way for someone looking through the API to go directly to the interface involved, like Thomas is saying, versus having to traverse through the extended class and its interfaces. A little uncomfortable with that, but it does make some sense.