mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8342863: Use pattern matching for instanceof in equals methods of wrapper classes
Reviewed-by: rriggs
This commit is contained in:
parent
e64f0798be
commit
a21c558699
8 changed files with 16 additions and 17 deletions
|
@ -9066,8 +9066,8 @@ class Character implements java.io.Serializable, Comparable<Character>, Constabl
|
|||
* {@code false} otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Character) {
|
||||
return value == ((Character)obj).charValue();
|
||||
if (obj instanceof Character c) {
|
||||
return value == c.charValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue