From 2daa0745611f4989a5dc99619dd4aef541288503 Mon Sep 17 00:00:00 2001 From: ryan-dia Date: Tue, 23 Jan 2024 12:47:04 +0900 Subject: [PATCH 1/2] Use count in ParamsRequestCondition#getValueMatchCount See gh-32088 --- .../servlet/mvc/condition/ParamsRequestCondition.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java index 590c71daa7df..0b04c6f82c9a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java @@ -137,13 +137,9 @@ public int compareTo(ParamsRequestCondition other, HttpServletRequest request) { } private long getValueMatchCount(Set expressions) { - long count = 0; - for (ParamExpression e : expressions) { - if (e.getValue() != null && !e.isNegated()) { - count++; - } - } - return count; + return expressions.stream() + .filter(e -> e.getValue() != null && !e.isNegated()) + .count(); } From def70756953ab8f22f9b90825d58ec397806b993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 23 Jan 2024 09:00:41 +0100 Subject: [PATCH 2/2] Upgrade copyright year of changed file See gh-32088 --- .../web/servlet/mvc/condition/ParamsRequestCondition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java index 0b04c6f82c9a..503cbafce2e2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.