Commit b1158bf3 authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

Simplify some Stream API usages

See gh-19291
parent 5b92cd84
......@@ -43,7 +43,7 @@ abstract class NamedContributorsMapAdapter<V, C> implements NamedContributors<C>
NamedContributorsMapAdapter(Map<String, V> map, Function<V, ? extends C> valueAdapter) {
Assert.notNull(map, "Map must not be null");
Assert.notNull(valueAdapter, "ValueAdapter must not be null");
map.keySet().stream().forEach((key) -> Assert.notNull(key, "Map must not contain null keys"));
map.keySet().forEach((key) -> Assert.notNull(key, "Map must not contain null keys"));
map.values().stream().map(valueAdapter)
.forEach((value) -> Assert.notNull(value, "Map must not contain null values"));
this.map = Collections.unmodifiableMap(new LinkedHashMap<>(map));
......
......@@ -69,7 +69,7 @@ public class SimpleStatusAggregator implements StatusAggregator {
@Override
public Status getAggregateStatus(Set<Status> statuses) {
return statuses.stream().filter(this::contains).sorted(this.comparator).findFirst().orElse(Status.UNKNOWN);
return statuses.stream().filter(this::contains).min(this.comparator).orElse(Status.UNKNOWN);
}
private boolean contains(Status status) {
......
......@@ -96,7 +96,7 @@ class EmbeddedMongoAutoConfigurationTests {
features.add(Feature.ONLY_WINDOWS_2008_SERVER);
}
load("spring.mongodb.embedded.features="
+ String.join(", ", features.stream().map(Feature::name).collect(Collectors.toList())));
+ features.stream().map(Feature::name).collect(Collectors.joining(", ")));
assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures())
.containsExactlyElementsOf(features);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment