Refactor iterator of Map with Java8's Map.forEach

See gh-1459
This commit is contained in:
diguage
2017-06-13 17:53:13 +08:00
committed by Stephane Nicoll
parent 7018804e84
commit 1ef5f61ab2
18 changed files with 72 additions and 130 deletions

View File

@@ -106,9 +106,7 @@ public class MethodMapTransactionAttributeSource
*/
protected void initMethodMap(@Nullable Map<String, TransactionAttribute> methodMap) {
if (methodMap != null) {
for (Map.Entry<String, TransactionAttribute> entry : methodMap.entrySet()) {
addTransactionalMethod(entry.getKey(), entry.getValue());
}
methodMap.forEach(this::addTransactionalMethod);
}
}

View File

@@ -61,9 +61,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
* @see TransactionAttributeEditor
*/
public void setNameMap(Map<String, TransactionAttribute> nameMap) {
for (Map.Entry<String, TransactionAttribute> entry : nameMap.entrySet()) {
addTransactionalMethod(entry.getKey(), entry.getValue());
}
nameMap.forEach(this::addTransactionalMethod);
}
/**