Polish "Use Map#forEach instead of Map#entrySet#forEach"
Closes gh-1449
This commit is contained in:
parent
2efa06237a
commit
451b419624
|
@ -265,7 +265,6 @@ public abstract class BeanFactoryUtils {
|
|||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
|
||||
parentResult.forEach((beanName, beanType) -> {
|
||||
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
result.put(beanName, beanType);
|
||||
|
@ -314,7 +313,6 @@ public abstract class BeanFactoryUtils {
|
|||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
|
||||
|
||||
parentResult.forEach((beanName, beanType) -> {
|
||||
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
result.put(beanName, beanType);
|
||||
|
|
|
@ -1187,11 +1187,9 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||
}
|
||||
}
|
||||
if (!this.customEditors.isEmpty()) {
|
||||
this.customEditors.forEach(
|
||||
(requiredType, editorClass)
|
||||
-> registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass))
|
||||
);
|
||||
}
|
||||
this.customEditors.forEach((requiredType, editorClass) ->
|
||||
registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -175,11 +175,10 @@ class DefaultClientRequestBuilder implements ClientRequest.Builder {
|
|||
|
||||
MultiValueMap<String, HttpCookie> requestCookies = request.getCookies();
|
||||
if (!this.cookies.isEmpty()) {
|
||||
this.cookies.forEach(( name , values) ->
|
||||
values.forEach(value -> {
|
||||
HttpCookie cookie = new HttpCookie(name, value);
|
||||
requestCookies.add(name, cookie);
|
||||
}));
|
||||
this.cookies.forEach((name, values) -> values.forEach(value -> {
|
||||
HttpCookie cookie = new HttpCookie(name, value);
|
||||
requestCookies.add(name, cookie);
|
||||
}));
|
||||
}
|
||||
|
||||
return this.inserter.insert(request, new BodyInserter.Context() {
|
||||
|
|
|
@ -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.
|
||||
|
@ -281,9 +281,8 @@ public class BaseViewTests {
|
|||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private void checkContainsAll(Map expected, Map<String, Object> actual) {
|
||||
expected.forEach(
|
||||
(k, v) -> assertEquals("Values for model key '" + k + "' must match", expected.get(k), actual.get(k))
|
||||
);
|
||||
expected.forEach((k, v) -> assertEquals("Values for model key '" + k
|
||||
+ "' must match", expected.get(k), actual.get(k)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -84,10 +84,8 @@ public class InternalResourceViewTests {
|
|||
view.render(model, request, response);
|
||||
assertEquals(url, response.getForwardedUrl());
|
||||
|
||||
|
||||
model.forEach(
|
||||
(key, value) -> assertEquals("Values for model key '" + key + "' must match", value, request.getAttribute(key))
|
||||
);
|
||||
model.forEach((key, value) -> assertEquals("Values for model key '" + key
|
||||
+ "' must match", value, request.getAttribute(key)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue