Skip to content

Commit 1ab678a

Browse files
committed
Polish "Refactor iterator of Map with Java8's Map.forEach"
Closes gh-1459
1 parent 1ef5f61 commit 1ab678a

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 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,6 +19,7 @@
1919
import java.util.Arrays;
2020
import java.util.Collection;
2121
import java.util.Collections;
22+
import java.util.Map;
2223
import java.util.concurrent.ConcurrentHashMap;
2324
import java.util.concurrent.ConcurrentMap;
2425

@@ -222,7 +223,9 @@ private void doSetCaffeine(Caffeine<Object, Object> cacheBuilder) {
222223
* Create the known caches again with the current state of this manager.
223224
*/
224225
private void refreshKnownCaches() {
225-
this.cacheMap.forEach((key, value) -> createCaffeineCache(key));
226+
for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) {
227+
entry.setValue(createCaffeineCache(entry.getKey()));
228+
}
226229
}
227230

228231
}

spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 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.

spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ public Object postProcessAfterInitialization(final Object bean, String beanName)
226226
else {
227227
// Non-empty set of methods
228228
annotatedMethods.forEach((method, listeners) ->
229-
listeners.forEach(listener -> processJmsListener(listener, method, bean)));
229+
listeners.forEach(listener ->
230+
processJmsListener(listener, method, bean)));
230231
if (logger.isDebugEnabled()) {
231232
logger.debug(annotatedMethods.size() + " @JmsListener methods processed on bean '" + beanName +
232233
"': " + annotatedMethods);

spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ public void addNativeHeaders(@Nullable MultiValueMap<String, String> headers) {
197197
if (headers == null) {
198198
return;
199199
}
200-
headers.forEach((key, values) -> values.forEach(value -> addNativeHeader(key, value)));
200+
headers.forEach((key, values) ->
201+
values.forEach(value -> addNativeHeader(key, value)));
201202
}
202203

203204
@Nullable

spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2017 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.

spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 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.

0 commit comments

Comments
 (0)