Skip to content

Commit

Permalink
8330815: Use pattern matching for instanceof in KeepAliveCache
Browse files Browse the repository at this point in the history
Backport-of: ddecbe52018fdb7556b04b20e8529eb430d3aa75
  • Loading branch information
RealCLanger committed May 16, 2024
1 parent 261ad5e commit fed9693
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, 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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -407,9 +407,9 @@ public KeepAliveKey(URL url, Object obj) {
*/
@Override
public boolean equals(Object obj) {
if ((obj instanceof KeepAliveKey) == false)
if (!(obj instanceof KeepAliveKey kae))
return false;
KeepAliveKey kae = (KeepAliveKey)obj;

return host.equals(kae.host)
&& (port == kae.port)
&& protocol.equals(kae.protocol)
Expand All @@ -423,7 +423,7 @@ public boolean equals(Object obj) {
@Override
public int hashCode() {
String str = protocol+host+port;
return this.obj == null? str.hashCode() :
return this.obj == null ? str.hashCode() :
str.hashCode() + this.obj.hashCode();
}
}
Expand Down

1 comment on commit fed9693

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.