Re: HashMap get/put
Thomas Pornin wrote:
According to Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>:
....
I think the virtual/non-virtual is a red herring
To that I agree. The absence of multiple inheritance is relevant: with
multiple inheritance, the List interface could be an abstract class
which would provide a default equals() method. Making that method
non-virtual would mean that it could prove difficult for any
implementation (extension) of List to escape that default equals()
method.
That is already done, in effect, by having most List implementations
directly or indirectly extend AbstractList, which provides an equals()
implementation consistent with the List contract. Multiple
implementation inheritance would allow one to combine the List and
AbstractList declarations into a single class that would both set the
rules, as is done by List, and provide default implementations, as is
done by AbstractList.
Without non-virtual methods, one would still need to make a single
decision about whether an ArrayList is equal to a similar Stack or not,
regardless of whether the referencing expressions are type List or type
ArrayList etc.
Patricia