Use Map.forEach instead of manual Map.Entry iteration wherever possible SPR-16646
This commit is contained in:
committed by
Juergen Hoeller
parent
224d52e032
commit
4aae6a6dda
@@ -660,9 +660,7 @@ public class Jackson2ObjectMapperBuilder {
|
||||
objectMapper.setFilterProvider(this.filters);
|
||||
}
|
||||
|
||||
for (Class<?> target : this.mixIns.keySet()) {
|
||||
objectMapper.addMixIn(target, this.mixIns.get(target));
|
||||
}
|
||||
this.mixIns.forEach((target, mixinSource) -> objectMapper.addMixIn(target, mixinSource));
|
||||
|
||||
if (!this.serializers.isEmpty() || !this.deserializers.isEmpty()) {
|
||||
SimpleModule module = new SimpleModule();
|
||||
@@ -672,9 +670,7 @@ public class Jackson2ObjectMapperBuilder {
|
||||
}
|
||||
|
||||
customizeDefaultFeatures(objectMapper);
|
||||
for (Object feature : this.features.keySet()) {
|
||||
configureFeature(objectMapper, feature, this.features.get(feature));
|
||||
}
|
||||
this.features.forEach((feature, enabled) -> configureFeature(objectMapper, feature, enabled));
|
||||
|
||||
if (this.handlerInstantiator != null) {
|
||||
objectMapper.setHandlerInstantiator(this.handlerInstantiator);
|
||||
@@ -699,16 +695,14 @@ public class Jackson2ObjectMapperBuilder {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> void addSerializers(SimpleModule module) {
|
||||
for (Class<?> type : this.serializers.keySet()) {
|
||||
module.addSerializer((Class<? extends T>) type, (JsonSerializer<T>) this.serializers.get(type));
|
||||
}
|
||||
this.serializers.forEach((type, serializer) ->
|
||||
module.addSerializer((Class<? extends T>) type, (JsonSerializer<T>) serializer));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> void addDeserializers(SimpleModule module) {
|
||||
for (Class<?> type : this.deserializers.keySet()) {
|
||||
module.addDeserializer((Class<T>) type, (JsonDeserializer<? extends T>) this.deserializers.get(type));
|
||||
}
|
||||
this.deserializers.forEach((type, deserializer) ->
|
||||
module.addDeserializer((Class<T>) type, (JsonDeserializer<? extends T>) deserializer));
|
||||
}
|
||||
|
||||
private void configureFeature(ObjectMapper objectMapper, Object feature, boolean enabled) {
|
||||
|
||||
@@ -112,12 +112,11 @@ public class SessionAttributesHandler {
|
||||
* @param attributes candidate attributes for session storage
|
||||
*/
|
||||
public void storeAttributes(WebRequest request, Map<String, ?> attributes) {
|
||||
for (String name : attributes.keySet()) {
|
||||
Object value = attributes.get(name);
|
||||
attributes.forEach((name, value) -> {
|
||||
if (value != null && isHandlerSessionAttribute(name, value.getClass())) {
|
||||
this.sessionAttributeStore.storeAttribute(request, name, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -567,11 +567,11 @@ public class UrlPathHelper {
|
||||
}
|
||||
else {
|
||||
MultiValueMap<String, String> decodedVars = new LinkedMultiValueMap<>(vars.size());
|
||||
for (String key : vars.keySet()) {
|
||||
for (String value : vars.get(key)) {
|
||||
vars.forEach((key, values) -> {
|
||||
for (String value : values) {
|
||||
decodedVars.add(key, decodeInternal(request, value));
|
||||
}
|
||||
}
|
||||
});
|
||||
return decodedVars;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user