aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Collection" Watch "Collection" New topic
Author

Collection

Nasir Khan
Ranch Hand

Joined: Nov 04, 2000
Posts: 135
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).]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
"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
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
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.

 
 
subject: Collection