Refactor equals method
To use the accessor method for username instead of directly accessing the attribute.
This commit is contained in:
committed by
Josh Cummings
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user