Forums Register Login

Collection

+Pie Number of slices to send: Send
Hi,
Some of the concrete calsses in collection package imlement the interfaces which are also implemeted by their abstract super
classes.For example
LinkedList extends AbstractSequentialList extends AbstractList.
Both AbstractList and LinkedList implement List interface.Why both do that ?I mean if AbstractList implements List interface all functionality of the iterface will go to LinkedList ( sub-sub class of AbstractList) so why does LinkedList implemet the interface again??
Similar confusion for ArrayList and Vector both implement List interface and their super class AbstractList do the same.
[This message has been edited by Nasir Khan (edited December 15, 2000).]
+Pie Number of slices to send: Send
"Both AbstractList and LinkedList implement List interface.Why both do that ?I mean if AbstractList implements List interface all functionality of the iterface will go to LinkedList ( sub-sub class of AbstractList) so why does LinkedList implemet the interface again??"
I imagine it is written that way in the source code to make sure the Javadocs documentation generator picks up the link. As you say, it is not strictly necessary since implementing an interface is inherited.
Bill
+Pie Number of slices to send: Send
Adding to the Bill's message Vector has got synchronized methods. Hence the programmer need not provide for sychronization where as ArrayList doesn't provide. Due to this the performance with ArrayList is better (that is what the books say!) than that of Vector that is if the programmer does not require synchronization.

Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 666 times.
Similar Threads
Interfaces
Explicit List implementation
Cast LinkedList to ArrayList, enjoy the class cast exception
Attributes - Navigability from type to attribute only
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:54:13.