defender methods and method of Object

Brian Goetz brian.goetz at oracle.com
Mon Mar 12 08:02:50 PDT 2012


> On the other hand, for those use cases where it does make sense to provide
> implementations (on collection classes, as several people have pointed
> out), it will not even be possible to do so unless steps are taken to
> enable it.

You can easily provide these methods in List as a favor to implementation classes.  For example, if List provided the equals and hashCode methods, a class could then easily choose to inherit them:

  int hashCode() { return List.super.hashCode(); }

without the class having to code them up by hand.  It is not as unwieldy as you make it sound.  

In any case, I think you have the sense of the burden backwards.  The bar is not "we should add special cases if anyone can imagine how they could be useful."  The bar is that the special case has to be overwhelmingly compelling.  I don't see it here.  




More information about the lambda-dev mailing list