Use Java 8 forEach method on Map
This commit is contained in:
committed by
Stephane Nicoll
parent
1ea54eb2c6
commit
13dc0cd828
@@ -264,12 +264,12 @@ public abstract class BeanFactoryUtils {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
for (Map.Entry<String, T> entry : parentResult.entrySet()) {
|
||||
parentResult.entrySet().forEach(entry -> {
|
||||
String beanName = entry.getKey();
|
||||
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
result.put(beanName, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -313,12 +313,13 @@ public abstract class BeanFactoryUtils {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
|
||||
for (Map.Entry<String, T> entry : parentResult.entrySet()) {
|
||||
|
||||
parentResult.entrySet().forEach(entry -> {
|
||||
String beanName = entry.getKey();
|
||||
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
result.put(beanName, entry.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -1177,11 +1177,11 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
if (!this.customEditors.isEmpty()) {
|
||||
for (Map.Entry<Class<?>, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
|
||||
this.customEditors.entrySet().forEach(entry -> {
|
||||
Class<?> requiredType = entry.getKey();
|
||||
Class<? extends PropertyEditor> editorClass = entry.getValue();
|
||||
registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user