java - Is there any benefit in implementing a interface in a subclass even though the superclass implements the same interface -
when seeing declaration of arraylist
class arraylist<e> extends abstractlist<e> implements list<e>, randomaccess, cloneable, java.io.serializable
which implements list interface eventhough arraylist's superclass abstractlist implements same list interface.
abstract class abstractlist<e> extends abstractcollection<e> implements list<e>
similar declarations can found on hashmap, linkedhashmap declarations also.
in declaration of linkedhashmap, implements map interface , not other interfaces implemented superclass hashmap.
so there might benefits of having such declarations.
there no functional benefits declaring them again, not affect behavior in way.
i guess it's added make clearer interfaces implemented.
Comments
Post a Comment