Map.Entry.setValue as a default method

Peter Levart peter.levart at gmail.com
Thu Nov 21 16:44:48 UTC 2013


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 boolean equals(Object x) { return 
>> KoolReusablePair.super.defaultEquals(x); }
>>     @Override //manual opt-in:
>>     public int hashCode() { return KoolReusablePair.hashCode(this); }
>>     ...
>>   }
>>
>> — John
>
> The plumber in me think that a static method unlike a default method 
> will not pollute the itable.

...and static interface method, unlike default, will not pollute the 
public API (static interface methods are not inherited).

Regards, Peter

>
> regards,
> Rémi 




More information about the core-libs-dev mailing list