Le 03/11/2009 20:32, Martin Buchholz a écrit :


On Tue, Nov 3, 2009 at 01:06, Rémi Forax <fo...@univ-mlv.fr <mailto:fo...@univ-mlv.fr>> wrote:

    Hi Martin,
    Your patch can break backward compat.

    add(E) now delegates to a public method (an overridable one)
    (addLast). So If I have a class that inherits from LinkedList
    and overrides addLast() the current semantics of add(E) is not
    altered,
    with your patch, add(E) semantics is also changed.

    I think the code of addLast() should be in a private method and
    addLast() and add(E) delegate to it.


Rémi, thanks for the review.  I've added you as a reviewer.

I agree.  Although relying on such implementation details is a bad idea,
and implementations are very likely to differ, and the existing LinkedList
is a hodge-podge of differing styles of methods calling other public
methods, we should strive to maintain this kind of compatibility if
the price is not too high.

Also, I did some cosmetic touchups, and commented out the asserts.

Webrev regenerated.

Martin


Good for me if addFirst() calls linkFirst() and
addLast() calls linkLast().

Rémi

Reply via email to