Skip to content

Commit 4b88293

Browse files
committed
Polish "Use removeIf rather than Iterator-based removal"
See gh-34762
1 parent 0d13e31 commit 4b88293

File tree

2 files changed

+4
-6
lines changed
  • spring-boot-project

2 files changed

+4
-6
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,9 +19,7 @@
1919
import java.security.Principal;
2020
import java.time.Duration;
2121
import java.util.Arrays;
22-
import java.util.Iterator;
2322
import java.util.Map;
24-
import java.util.Map.Entry;
2523
import java.util.Objects;
2624

2725
import reactor.core.publisher.Flux;
@@ -109,7 +107,7 @@ private CacheKey getCacheKey(InvocationContext context) {
109107

110108
private void cleanExpiredCachedResponses(long accessTime) {
111109
try {
112-
this.cachedResponses.entrySet().removeIf(entry -> entry.getValue().isStale(accessTime, this.timeToLive));
110+
this.cachedResponses.entrySet().removeIf((entry) -> entry.getValue().isStale(accessTime, this.timeToLive));
113111
}
114112
catch (Exception ex) {
115113
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Collections;
2525
import java.util.HashMap;
2626
import java.util.HashSet;
27-
import java.util.Iterator;
2827
import java.util.LinkedHashSet;
2928
import java.util.List;
3029
import java.util.Locale;
@@ -182,7 +181,8 @@ protected final MatchResult getMatchingBeans(ConditionContext context, Spec<?> s
182181
for (String type : spec.getTypes()) {
183182
Collection<String> typeMatches = getBeanNamesForType(classLoader, considerHierarchy, beanFactory, type,
184183
parameterizedContainers);
185-
typeMatches.removeIf(match -> beansIgnoredByType.contains(match) || ScopedProxyUtils.isScopedTarget(match));
184+
typeMatches
185+
.removeIf((match) -> beansIgnoredByType.contains(match) || ScopedProxyUtils.isScopedTarget(match));
186186
if (typeMatches.isEmpty()) {
187187
result.recordUnmatchedType(type);
188188
}

0 commit comments

Comments
 (0)