As shown in java.util.*
, AbstractSet<E> implements Set<E>
, so why HashSet<E> extends AbstractSet<E> implements Set<E>
? Is the "implements Set<E>
" duplicated here?
This has been done to be able to override the javadoc documentation.
The javadoc for HashSet<E>
and AbstractSet<E>
differ for example.
It can also be done for more clarity.
Yes it is duplicated, but I guess it is a coding style decision. I as well do prefer to explicitly implement the interfaces a type is motivated to be introduced for. The extends is just an implementation detail, most often motivated by reuse. Hence, the type which inherits from the base class will be stable even when removing the base class and implementing those functionality in some other way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With