RFR: 8263233: Update java.net and java.nio to use instanceof pattern variable [v3]

Patrick Concannon pconcannon at openjdk.java.net
Tue Mar 9 20:27:09 UTC 2021


On Tue, 9 Mar 2021 18:22:17 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

>> Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8263233: Refactored equals method further
>
> src/java.base/share/classes/java/net/InterfaceAddress.java line 108:
> 
>> 106:             if (Objects.equals(address, cmp.address) &&
>> 107:                 Objects.equals(broadcast, cmp.broadcast) &&
>> 108:                 maskLength == cmp.maskLength)
> 
> Apologies Patrick, building on Michael's suggestion, then you'd end up at:
>  
>      public boolean equals(Object obj) {
>           return obj instanceof InterfaceAddress cmp
>                    && Objects.equals(address, cmp.address)
>                    && Objects.equals(broadcast, cmp.broadcast)
>                    && maskLength == cmp.maskLength;
>       }

My mistake. I've fixed that now. See 27a58926be98ef0137244183ac0ee21c88967a1c

-------------

PR: https://git.openjdk.java.net/jdk/pull/2890


More information about the net-dev mailing list