mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8330815: Use pattern matching for instanceof in KeepAliveCache
Reviewed-by: jpai, djelinski
This commit is contained in:
parent
d43654e573
commit
e818ab60a0
1 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -389,9 +389,9 @@ class KeepAliveKey {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if ((obj instanceof KeepAliveKey) == false)
|
if (!(obj instanceof KeepAliveKey kae))
|
||||||
return false;
|
return false;
|
||||||
KeepAliveKey kae = (KeepAliveKey)obj;
|
|
||||||
return host.equals(kae.host)
|
return host.equals(kae.host)
|
||||||
&& (port == kae.port)
|
&& (port == kae.port)
|
||||||
&& protocol.equals(kae.protocol)
|
&& protocol.equals(kae.protocol)
|
||||||
|
@ -405,7 +405,7 @@ class KeepAliveKey {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
String str = protocol+host+port;
|
String str = protocol+host+port;
|
||||||
return this.obj == null? str.hashCode() :
|
return this.obj == null ? str.hashCode() :
|
||||||
str.hashCode() + this.obj.hashCode();
|
str.hashCode() + this.obj.hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue