Use Map#forEach instead of Map#entrySet#forEach

See gh-1449
This commit is contained in:
diguage
2017-06-05 16:39:28 +08:00
committed by Stephane Nicoll
parent 424bc75fb1
commit 2efa06237a
10 changed files with 38 additions and 39 deletions

View File

@@ -265,10 +265,10 @@ public abstract class BeanFactoryUtils {
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
parentResult.entrySet().forEach(entry -> {
String beanName = entry.getKey();
parentResult.forEach((beanName, beanType) -> {
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
result.put(beanName, entry.getValue());
result.put(beanName, beanType);
}
});
}
@@ -314,11 +314,10 @@ public abstract class BeanFactoryUtils {
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
parentResult.entrySet().forEach(entry -> {
String beanName = entry.getKey();
parentResult.forEach((beanName, beanType) -> {
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
result.put(beanName, entry.getValue());
result.put(beanName, beanType);
}
});
}

View File

@@ -1187,12 +1187,11 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
}
}
if (!this.customEditors.isEmpty()) {
this.customEditors.entrySet().forEach(entry -> {
Class<?> requiredType = entry.getKey();
Class<? extends PropertyEditor> editorClass = entry.getValue();
registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass));
});
}
this.customEditors.forEach(
(requiredType, editorClass)
-> registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass))
);
}
}