Why isEmpty(), retainAll() and containsAll() not supported with default implementations in JDK8?

Paul Sandoz paul.sandoz at oracle.com
Fri Feb 14 14:50:59 UTC 2014


On Feb 14, 2014, at 2:13 PM, Roman Leventov <leventov at ya.ru> wrote:
> I'm sure there was a discussion somewhere in JDK mailing lists, but I couldn't find. Please, give me a link.
> 

I cannot recall such discussion.

Generally we have only converted existing abstract methods on an interface to non-abstract if there was a compelling reason to aid implementations, such as Iterator.remove.

These are not new methods on Collection, and there are already implementations in AbstractCollection. The advantage of converting these abstract into non-abstract methods its not particularly compelling given one is most likely to inherit from AbstractCollection or provide more efficient implementations.

It would be possible to move all non-abstract methods on AbstractCollection to Collection. If we were starting from a blank sheet of paper that is what we might have done. (Note one cannot do this with all non-abstract methods on AbstractList.)


> I've tried to ask on SO: http://stackoverflow.com/questions/21758081/why-many-methods-in-jcf-interfaces-not-made-default-in-java-8, proved that JDK developers don't read SO :)


I don't :-) i know others do, and Stuart replied:

  http://stackoverflow.com/a/21774137

Paul.


More information about the core-libs-dev mailing list