Fork me on GitHub

I have been looking at OpenJDK Java source code for java.util.List and java.util.Collection interfaces, and it seems that even though the first interface extends the second one, most of the method signatures in Collection are repeated in List. Does anyone know why they might do it that way? It is redundant to do so, true?


Both of those interfaces contain method signatures for equals and hashCode that are required for every Java Object or sub-class (which is all Java objects), which also seems redundant.


Perhaps it is done to provide more specific doc strings for those methods in those interfaces?

👍 4

Almost certainly, I suspect, I can’t think of another reason to do so.

👍 4