Skip to content

Commit 8295c8a

Browse files
committed
Refactor hashCode method in DefaultAddressStandardClaim
Extract magic number 31 to variable Signed-off-by: kimjg <[email protected]>
1 parent 31fb7fe commit 8295c8a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaim.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ public boolean equals(Object obj) {
105105

106106
@Override
107107
public int hashCode() {
108+
108109
int result = (this.getFormatted() != null) ? this.getFormatted().hashCode() : 0;
109-
result = 31 * result + ((this.getStreetAddress() != null) ? this.getStreetAddress().hashCode() : 0);
110-
result = 31 * result + ((this.getLocality() != null) ? this.getLocality().hashCode() : 0);
111-
result = 31 * result + ((this.getRegion() != null) ? this.getRegion().hashCode() : 0);
112-
result = 31 * result + ((this.getPostalCode() != null) ? this.getPostalCode().hashCode() : 0);
113-
result = 31 * result + ((this.getCountry() != null) ? this.getCountry().hashCode() : 0);
110+
int thirtyOne = 31;
111+
112+
result = thirtyOne * result + ((this.getStreetAddress() != null) ? this.getStreetAddress().hashCode() : 0);
113+
result = thirtyOne * result + ((this.getLocality() != null) ? this.getLocality().hashCode() : 0);
114+
result = thirtyOne * result + ((this.getRegion() != null) ? this.getRegion().hashCode() : 0);
115+
result = thirtyOne * result + ((this.getPostalCode() != null) ? this.getPostalCode().hashCode() : 0);
116+
result = thirtyOne * result + ((this.getCountry() != null) ? this.getCountry().hashCode() : 0);
114117
return result;
115118
}
116119

0 commit comments

Comments
 (0)