Use lambdas for map entry iteration where possible

See gh-12626
This commit is contained in:
igor-suhorukov
2018-03-24 09:19:03 +03:00
committed by Phillip Webb
parent 78a94cafe1
commit 69bc19e0ca
31 changed files with 125 additions and 232 deletions

View File

@@ -123,15 +123,14 @@ public class ConditionsReportEndpoint {
this.negativeMatches = new LinkedHashMap<>();
this.exclusions = report.getExclusions();
this.unconditionalClasses = report.getUnconditionalClasses();
for (Map.Entry<String, ConditionAndOutcomes> entry : report
.getConditionAndOutcomesBySource().entrySet()) {
if (entry.getValue().isFullMatch()) {
add(this.positiveMatches, entry.getKey(), entry.getValue());
report.getConditionAndOutcomesBySource().forEach((key, value) -> {
if (value.isFullMatch()) {
add(this.positiveMatches, key, value);
}
else {
add(this.negativeMatches, entry.getKey(), entry.getValue());
add(this.negativeMatches, key, value);
}
}
});
this.parentId = context.getParent() == null ? null
: context.getParent().getId();
}

View File

@@ -44,10 +44,7 @@ public abstract class CompositeHealthIndicatorConfiguration<H extends HealthIndi
}
CompositeHealthIndicator composite = new CompositeHealthIndicator(
this.healthAggregator);
for (Map.Entry<String, S> entry : beans.entrySet()) {
composite.addHealthIndicator(entry.getKey(),
createHealthIndicator(entry.getValue()));
}
beans.forEach((key, value) -> composite.addHealthIndicator(key, createHealthIndicator(value)));
return composite;
}

View File

@@ -43,10 +43,7 @@ public abstract class CompositeReactiveHealthIndicatorConfiguration<H extends Re
}
CompositeReactiveHealthIndicator composite = new CompositeReactiveHealthIndicator(
this.healthAggregator);
for (Map.Entry<String, S> entry : beans.entrySet()) {
composite.addHealthIndicator(entry.getKey(),
createHealthIndicator(entry.getValue()));
}
beans.forEach((key, value) -> composite.addHealthIndicator(key, createHealthIndicator(value)));
return composite;
}

View File

@@ -84,11 +84,11 @@ public class DataSourceHealthIndicatorAutoConfiguration extends
return null;
}
Map<String, DataSource> dataSources = new LinkedHashMap<>();
for (Map.Entry<String, DataSource> entry : candidates.entrySet()) {
if (!(entry.getValue() instanceof AbstractRoutingDataSource)) {
dataSources.put(entry.getKey(), entry.getValue());
candidates.forEach((key, value) -> {
if (!(value instanceof AbstractRoutingDataSource)) {
dataSources.put(key, value);
}
}
});
return dataSources;
}