Simplify some Stream API usages
See gh-19291
This commit is contained in:
committed by
Stephane Nicoll
parent
5b92cd841d
commit
b1158bf35d
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user