Refactor equals method
To use the accessor method for username instead of directly accessing the attribute.
This commit is contained in:
parent
ea19f82b8a
commit
de1357cbd1
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue