Refactor iterator of Map with Java8's Map.forEach

See gh-1459
This commit is contained in:
diguage
2017-06-13 17:53:13 +08:00
committed by Stephane Nicoll
parent 7018804e84
commit 1ef5f61ab2
18 changed files with 72 additions and 130 deletions

View File

@@ -225,12 +225,8 @@ public class JmsListenerAnnotationBeanPostProcessor
}
else {
// Non-empty set of methods
for (Map.Entry<Method, Set<JmsListener>> entry : annotatedMethods.entrySet()) {
Method method = entry.getKey();
for (JmsListener listener : entry.getValue()) {
processJmsListener(listener, method, bean);
}
}
annotatedMethods.forEach((method, listeners) ->
listeners.forEach(listener -> processJmsListener(listener, method, bean)));
if (logger.isDebugEnabled()) {
logger.debug(annotatedMethods.size() + " @JmsListener methods processed on bean '" + beanName +
"': " + annotatedMethods);

View File

@@ -158,12 +158,10 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
*/
public void setTypeIdMappings(Map<String, Class<?>> typeIdMappings) {
this.idClassMappings = new HashMap<>();
for (Map.Entry<String, Class<?>> entry : typeIdMappings.entrySet()) {
String id = entry.getKey();
Class<?> clazz = entry.getValue();
typeIdMappings.forEach((id, clazz) -> {
this.idClassMappings.put(id, clazz);
this.classIdMappings.put(clazz, id);
}
});
}
@Override