Polish "Refact iterator of Map with Java 8 forEach"
Closes gh-1451
This commit is contained in:
parent
dab7a7f0ee
commit
27aabb15f9
|
@ -87,10 +87,8 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
// There is no replacement of existing property values.
|
||||
if (original != null) {
|
||||
this.propertyValueList = new ArrayList<>(original.size());
|
||||
original.forEach(
|
||||
(attrName, attrValue)
|
||||
-> this.propertyValueList.add(new PropertyValue(attrName.toString(), attrValue))
|
||||
);
|
||||
original.forEach((attrName, attrValue) -> this.propertyValueList.add(
|
||||
new PropertyValue(attrName.toString(), attrValue)));
|
||||
}
|
||||
else {
|
||||
this.propertyValueList = new ArrayList<>(0);
|
||||
|
@ -152,10 +150,8 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
*/
|
||||
public MutablePropertyValues addPropertyValues(@Nullable Map<?, ?> other) {
|
||||
if (other != null) {
|
||||
other.forEach(
|
||||
(attrName, attrValue)
|
||||
-> addPropertyValue(new PropertyValue(attrName.toString(), attrValue))
|
||||
);
|
||||
other.forEach((attrName, attrValue) -> addPropertyValue(
|
||||
new PropertyValue(attrName.toString(), attrValue)));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
|||
String actualPropertyName =
|
||||
(nestedProperty != null ? PropertyAccessorUtils.getPropertyName(nestedProperty) : null);
|
||||
if (this.customEditors != null) {
|
||||
this.customEditors.forEach((clazz, propertyEditor) -> target.registerCustomEditor(clazz, propertyEditor));
|
||||
this.customEditors.forEach(target::registerCustomEditor);
|
||||
}
|
||||
if (this.customEditorsForPath != null) {
|
||||
for (Map.Entry<String, CustomEditorHolder> entry : this.customEditorsForPath.entrySet()) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ConstructorArgumentValues {
|
|||
);
|
||||
other.genericArgumentValues.stream()
|
||||
.filter(valueHolder -> !this.genericArgumentValues.contains(valueHolder))
|
||||
.forEach(valueHolder -> addOrMergeGenericArgumentValue(valueHolder));
|
||||
.forEach(valueHolder -> addOrMergeGenericArgumentValue(valueHolder.copy()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.beans.factory.config;
|
||||
|
||||
import java.beans.PropertyEditor;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -141,7 +140,9 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, Ordered
|
|||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (this.propertyEditorRegistrars != null) {
|
||||
Arrays.stream(this.propertyEditorRegistrars).forEach(beanFactory::addPropertyEditorRegistrar);
|
||||
for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) {
|
||||
beanFactory.addPropertyEditorRegistrar(propertyEditorRegistrar);
|
||||
}
|
||||
}
|
||||
if (this.customEditors != null) {
|
||||
this.customEditors.forEach(beanFactory::registerCustomEditor);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -351,7 +351,8 @@ class ConfigurationClassBeanDefinitionReader {
|
|||
}
|
||||
|
||||
private void loadBeanDefinitionsFromRegistrars(Map<ImportBeanDefinitionRegistrar, AnnotationMetadata> registrars) {
|
||||
registrars.forEach((registrar, metadata) -> registrar.registerBeanDefinitions(metadata, this.registry));
|
||||
registrars.forEach((registrar, metadata) ->
|
||||
registrar.registerBeanDefinitions(metadata, this.registry));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -544,7 +544,8 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
|||
}
|
||||
|
||||
if (!this.beans.isEmpty()) {
|
||||
this.beans.forEach((beanName, instance) -> registerBeanNameOrInstance(instance, beanName));
|
||||
this.beans.forEach((beanName, instance) ->
|
||||
registerBeanNameOrInstance(instance, beanName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -53,10 +53,8 @@ public abstract class AbstractConfigurableMBeanInfoAssembler extends AbstractRef
|
|||
}
|
||||
|
||||
public void setNotificationInfoMappings(Map<String, Object> notificationInfoMappings) {
|
||||
notificationInfoMappings.forEach(
|
||||
(beanKey, result)
|
||||
-> this.notificationInfoMappings.put(beanKey, extractNotificationMetadata(result))
|
||||
);
|
||||
notificationInfoMappings.forEach((beanKey, result) ->
|
||||
this.notificationInfoMappings.put(beanKey, extractNotificationMetadata(result)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -315,11 +315,8 @@ public class ScheduledAnnotationBeanPostProcessor
|
|||
}
|
||||
else {
|
||||
// Non-empty set of methods
|
||||
annotatedMethods.forEach((method, scheduleds) -> {
|
||||
for (Scheduled scheduled : scheduleds) {
|
||||
processScheduled(scheduled, method, bean);
|
||||
}
|
||||
});
|
||||
annotatedMethods.forEach((method, scheduledMethods) ->
|
||||
scheduledMethods.forEach(scheduled -> processScheduled(scheduled, method, bean)));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(annotatedMethods.size() + " @Scheduled methods processed on bean '" + beanName +
|
||||
"': " + annotatedMethods);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-201 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -147,7 +147,7 @@ public class MethodMetadataReadingVisitor extends MethodVisitor implements Metho
|
|||
for (AnnotationAttributes annotationAttributes : attributesList) {
|
||||
AnnotationAttributes convertedAttributes = AnnotationReadingVisitorUtils.convertClassValues(
|
||||
"method '" + getMethodName() + "'", this.classLoader, annotationAttributes, classValuesAsString);
|
||||
convertedAttributes.forEach((attrName, attrValue) -> allAttributes.add(attrName, attrValue));
|
||||
convertedAttributes.forEach(allAttributes::add);
|
||||
}
|
||||
}
|
||||
return allAttributes;
|
||||
|
|
|
@ -455,7 +455,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
|||
|
||||
private void appendTo(Map<String, String> map, StringBuilder builder) {
|
||||
map.forEach((key, val) -> {
|
||||
builder.append(";");
|
||||
builder.append(';');
|
||||
builder.append(key);
|
||||
builder.append('=');
|
||||
builder.append(val);
|
||||
|
|
|
@ -99,10 +99,8 @@ class StaxEventHandler extends AbstractStaxHandler {
|
|||
|
||||
private List<Namespace> getNamespaces(Map<String, String> namespaceMapping) {
|
||||
List<Namespace> result = new ArrayList<>();
|
||||
namespaceMapping.forEach(
|
||||
(prefix, namespaceUri)
|
||||
-> result.add(this.eventFactory.createNamespace(prefix, namespaceUri))
|
||||
);
|
||||
namespaceMapping.forEach((prefix, namespaceUri) ->
|
||||
result.add(this.eventFactory.createNamespace(prefix, namespaceUri)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
Loading…
Reference in New Issue