Skip to content

Commit

Permalink
Polish some Collectors
Browse files Browse the repository at this point in the history
  • Loading branch information
dreis2211 authored and snicoll committed Aug 27, 2018
1 parent 10c3c08 commit 422a436
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -83,7 +82,7 @@ private Set<String> asSet(Collection<String> items) {
return Collections.emptySet();
}
return items.stream().map((item) -> item.toLowerCase(Locale.ENGLISH))
.collect(Collectors.toCollection(HashSet::new));
.collect(Collectors.toSet());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private <T> Set<T> merge(Set<T> set1, Set<T> set2) {
private <K, V, T> List<T> asList(Map<K, V> map, BiFunction<K, V, T> mapper) {
return map.entrySet().stream()
.map((entry) -> mapper.apply(entry.getKey(), entry.getValue()))
.collect(Collectors.toCollection(ArrayList::new));
.collect(Collectors.toList());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
Expand All @@ -16,7 +16,6 @@

package org.springframework.boot.autoconfigure;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -48,11 +47,11 @@ protected AutoConfigurations(Collection<Class<?>> classes) {
@Override
protected Collection<Class<?>> sort(Collection<Class<?>> classes) {
List<String> names = classes.stream().map(Class::getName)
.collect(Collectors.toCollection(ArrayList::new));
.collect(Collectors.toList());
List<String> sorted = SORTER.getInPriorityOrder(names);
return sorted.stream()
.map((className) -> ClassUtils.resolveClassName(className, null))
.collect(Collectors.toCollection(ArrayList::new));
.collect(Collectors.toList());
}

@Override
Expand Down

0 comments on commit 422a436

Please sign in to comment.