Final defenders

"Zdeněk Troníček" tronicek at
Wed Aug 8 00:35:17 PDT 2012

Hi Daniel,

unfortunately, these arguments are going against a basic principal in OO
programming. You asked so that List knows about the classes that
implements it.

Zdenek Tronicek
FIT CTU in Prague

Daniel Latrémolière napsal(a):
>> Hi,
>> these methods should be in a class if they are useful. E.g. in
>> java.util.Collections.
>> Z.
> By being in List interface, they are easier to find. In an external
> class, they have a very small value comparing to current constructors.
> Static methods from classes like Collections, Arrays are not useful for
> beginners because they are impossible to find in a very big API like
> Java).
> But, if you know that all lifecycle (factory for creation, change of
> content, etc.) of a List is managed by List interface, you know exactly
> where to find the solution of your problem. You can even publish a
> subset of javadocs of Java without implementing classes like ArrayList,
> LinkedList, etc. which will be much more clear for learning Java and
> attracting new users.
> A defender method in interface can too be a method in Collections class
> (even allowing specialized implementation with a service to be
> implemented), but this is always more difficult to find and it give
> globally a very complex API.
> Daniel.

More information about the lambda-dev mailing list