Why java.util.ArrayList needs to implement java.util.List?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ramakrishna_Duggineni
Posted On:   Friday, May 7, 2004 12:11 AM

Why java.util.ArrayList needs to implement java.util.List, although it is extending java.util.AbstractList(which is already implemented the java.util.List)?

Re: Why java.util.ArrayList needs to implement java.util.List?

Posted By:   Sean_Owen  
Posted On:   Friday, May 7, 2004 11:43 AM

Strictly speaking, it does not need to declare "implements List" since as you say it extends AbstractList, which already implements List.



I think it is done to make the programmer's intent clear; it's a question of style. ArrayList should definitely implement List, so the programmer writes that. It also extends AbstractList, which implements List, but if that were to change we want to know that ArrayList still implements List. That is, the fact that ArrayList implements List should not depend on the fact that it happens to extend AbstractList.

About | Sitemap | Contact