Map.Entry.setValue as a default method

Mike Duigou mike.duigou at oracle.com
Wed Nov 20 23:07:51 UTC 2013


It could still be added in a future rev. setValue was less compelling and obviously correct than Iterator.remove(). I had a version of Map.Entry earlier on which provided provided setValue() along defaults for the required implementations of hashCode() and equals(). The spec for these later two methods is part of the API so defaults seemed appropriate. We essentially didn't implement them to avoid scope creep--none of these were strictly necessary for our other goals. For Iterator.remove() we could get immediate benefit.

Mike

On Nov 20 2013, at 14:54 , Remi Forax <forax at univ-mlv.fr> wrote:

> A good question of one of my student,
> why Iterator.remove() is a default method that throws UOE in 8 but Map.Entry.setValue() is not a default method with the same semantics.
> 
> regards,
> RĂ©mi
> 




More information about the core-libs-dev mailing list