Re: Map.Entry.setValue as a default method

2013-11-21 Thread Remi Forax
On 11/21/2013 02:08 AM, John Rose wrote: On Nov 20, 2013, at 4:31 PM, Remi Forax > wrote: But while you can declare a default hashCode and equals, it will not work because the implementation of Object.hashCode and Object.equals will always be preferred to the default

Re: Map.Entry.setValue as a default method

2013-11-21 Thread Peter Levart
On 11/21/2013 03:56 PM, Remi Forax wrote: Maybe one of: interface KoolReusablePair { default boolean defaultEquals(Object x) { ... } static int hashCode(KoolReusablePair self) { ... } ... } class KoolImpl implements KoolReusablePair { @Override //manual opt-in: public b

Re: Map.Entry.setValue as a default method

2013-11-20 Thread John Rose
On Nov 20, 2013, at 4:31 PM, Remi Forax wrote: > But while you can declare a default hashCode and equals, it will not work > because the implementation of Object.hashCode and Object.equals will always > be preferred to the default methods by the VM, this is how default methods > are specified.

Re: Map.Entry.setValue as a default method

2013-11-20 Thread Mike Duigou
On Nov 20 2013, at 16:31 , Remi Forax wrote: > Hi mike, > > On 11/21/2013 12:07 AM, Mike Duigou wrote: >> It could still be added in a future rev. > > yes, I've post that here as a remainder for the future generation :) > >> setValue was less compelling and obviously correct than Iterator.re

Re: Map.Entry.setValue as a default method

2013-11-20 Thread Remi Forax
Hi mike, On 11/21/2013 12:07 AM, Mike Duigou wrote: It could still be added in a future rev. yes, I've post that here as a remainder for the future generation :) setValue was less compelling and obviously correct than Iterator.remove(). I had a version of Map.Entry earlier on which provid

Re: Map.Entry.setValue as a default method

2013-11-20 Thread Mike Duigou
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

Map.Entry.setValue as a default method

2013-11-20 Thread Remi Forax
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