• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Collection

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic