diff --git a/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java index 73056c57fc..1771721b7f 100644 --- a/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java @@ -462,11 +462,7 @@ public class DaoAuthenticationProviderTests { } private double avg(List counts) { - long sum = 0; - for (Long time : counts) { - sum += time; - } - return sum / counts.size(); + return counts.stream().mapToLong(Long::longValue).average().orElse(0); } @Test