On Tue, 9 Mar 2021 17:59:27 GMT, Patrick Concannon <[email protected]>
wrote:
>> Hi,
>>
>> Could someone please review my code for updating the code in the `java.net`
>> and `java.nio` packages to make use of the `instanceof` pattern variable?
>>
>> Kind regards,
>> Patrick
>
> Patrick Concannon has updated the pull request incrementally with one
> additional commit since the last revision:
>
> 8263233: Small refactor of equals method in java/net/InterfaceAddress;
> removed superfluous whitespace in java/net/Inet6Address
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;
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/2890