Refactor iterator of Map with Java8's Map.forEach
See gh-1459
This commit is contained in:
@@ -131,13 +131,12 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource {
|
||||
*/
|
||||
public MapSqlParameterSource addValues(@Nullable Map<String, ?> values) {
|
||||
if (values != null) {
|
||||
for (Map.Entry<String, ?> entry : values.entrySet()) {
|
||||
this.values.put(entry.getKey(), entry.getValue());
|
||||
if (entry.getValue() instanceof SqlParameterValue) {
|
||||
SqlParameterValue value = (SqlParameterValue) entry.getValue();
|
||||
registerSqlType(entry.getKey(), value.getSqlType());
|
||||
values.forEach((key, value) -> {
|
||||
this.values.put(key, value);
|
||||
if (value instanceof SqlParameterValue) {
|
||||
registerSqlType(key, ((SqlParameterValue) value).getSqlType());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -114,11 +114,11 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple
|
||||
throw new IllegalArgumentException("Property 'targetDataSources' is required");
|
||||
}
|
||||
this.resolvedDataSources = new HashMap<>(this.targetDataSources.size());
|
||||
for (Map.Entry<Object, Object> entry : this.targetDataSources.entrySet()) {
|
||||
Object lookupKey = resolveSpecifiedLookupKey(entry.getKey());
|
||||
DataSource dataSource = resolveSpecifiedDataSource(entry.getValue());
|
||||
this.targetDataSources.forEach((key, value) -> {
|
||||
Object lookupKey = resolveSpecifiedLookupKey(key);
|
||||
DataSource dataSource = resolveSpecifiedDataSource(value);
|
||||
this.resolvedDataSources.put(lookupKey, dataSource);
|
||||
}
|
||||
});
|
||||
if (this.defaultTargetDataSource != null) {
|
||||
this.resolvedDefaultDataSource = resolveSpecifiedDataSource(this.defaultTargetDataSource);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user