Why does ArrayList have "implements List"?

collections, java

Solution

Yes. It could've been omitted. But thus it is immediately visible that it is a `List`. Otherwise an extra click through the code / documentation would be required. I think that's the reason - clarity.

And to add what Joeri Hendrickx commented - it is for the purpose of showing that `ArrayList` implements `List`. `AbstractList` in the whole picture is just for convenience and to reduce code duplication between `List` implementations.

Problem

In the Collection Framework we have the interface `List` and the class `AbstractList`: ``` AbstractList implements List ``` And `ArrayList` extends `AbstractList` and ``` implements List ``` My question: why does `ArrayList` have the `implements List` clause? If `ArrayList extends AbstractList` and `AbstractList implements List`, can't we say, that `ArrayList implement List`?

Original source

Related problems