mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Refactor calculateHashCode method for clarity
This will: 1. Mathematical Distribution (Collision Reduction) 2. Pipelining and CPU Caching 3. Avoiding "Method Heavy" Expressions See gh-36325 Signed-off-by: Agil <41694337+AgilAghamirzayev@users.noreply.github.com>
This commit is contained in:
+13
-5
@@ -541,11 +541,19 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
|
||||
@SuppressWarnings({"ConstantConditions", "NullAway", "removal"})
|
||||
private int calculateHashCode() {
|
||||
return (this.pathPatternsCondition != null ? this.pathPatternsCondition : this.patternsCondition).hashCode() * 31 +
|
||||
this.methodsCondition.hashCode() +
|
||||
this.paramsCondition.hashCode() + this.headersCondition.hashCode() +
|
||||
this.consumesCondition.hashCode() + this.producesCondition.hashCode() +
|
||||
this.versionCondition.hashCode() + this.customConditionHolder.hashCode();
|
||||
Object patternBase = (this.pathPatternsCondition != null)
|
||||
? this.pathPatternsCondition
|
||||
: this.patternsCondition;
|
||||
|
||||
int h = patternBase.hashCode();
|
||||
h = 31 * h + methodsCondition.hashCode();
|
||||
h = 31 * h + paramsCondition.hashCode();
|
||||
h = 31 * h + headersCondition.hashCode();
|
||||
h = 31 * h + consumesCondition.hashCode();
|
||||
h = 31 * h + producesCondition.hashCode();
|
||||
h = 31 * h + customConditionHolder.hashCode();
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user