mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Use removeIf rather than Iterator-based removal
See gh-34762
This commit is contained in:
parent
5a6e7d1226
commit
0d13e31827
@ -109,13 +109,7 @@ public class CachingOperationInvoker implements OperationInvoker {
|
||||
|
||||
private void cleanExpiredCachedResponses(long accessTime) {
|
||||
try {
|
||||
Iterator<Entry<CacheKey, CachedResponse>> iterator = this.cachedResponses.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entry<CacheKey, CachedResponse> entry = iterator.next();
|
||||
if (entry.getValue().isStale(accessTime, this.timeToLive)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
this.cachedResponses.entrySet().removeIf(entry -> entry.getValue().isStale(accessTime, this.timeToLive));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
|
@ -182,13 +182,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
|
||||
for (String type : spec.getTypes()) {
|
||||
Collection<String> typeMatches = getBeanNamesForType(classLoader, considerHierarchy, beanFactory, type,
|
||||
parameterizedContainers);
|
||||
Iterator<String> iterator = typeMatches.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String match = iterator.next();
|
||||
if (beansIgnoredByType.contains(match) || ScopedProxyUtils.isScopedTarget(match)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
typeMatches.removeIf(match -> beansIgnoredByType.contains(match) || ScopedProxyUtils.isScopedTarget(match));
|
||||
if (typeMatches.isEmpty()) {
|
||||
result.recordUnmatchedType(type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user