• Post Reply Bookmark Topic Watch Topic
  • New Topic

iterator() in ArrayList  RSS feed

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have one query ,

I have seen in the java doc , ArrayList inherited iterator() from its super class java.util.AbstractList and from interface java.util.List.
I am not able to understand why it is inheriting same method from different place ?

Could ny body explain me what is the reason ?


regards,
S
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AbstractList implements java.util.List as well, so it's not a "different place".

Besides, nothing is ever inherited from an interface.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but I have seen in the java doc
webpage
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Bear said, nothing is inherited from an interface. The List interface only tells ArrayList that it must have a method "public Iterator<E> iterator()". AbstractList already has that method implemented, so ArrayList inherits that method. There's no inheritance there; if you check the API page for AbstractList, it says "specified by", not "overrides".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!