Refactor equals method

To use the accessor method for username instead of directly accessing the attribute.
This commit is contained in:
Seongguk Jeong 2023-07-17 22:15:41 +09:00 committed by Josh Cummings
parent ea19f82b8a
commit de1357cbd1
1 changed files with 2 additions and 2 deletions

View File

@ -179,8 +179,8 @@ public class User implements UserDetails, CredentialsContainer {
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof User) {
return this.username.equals(((User) obj).username);
if (obj instanceof User user) {
return this.username.equals(user.getUsername());
}
return false;
}