拼团活动:完善 review 提到的问题

This commit is contained in:
puhui999
2023-10-08 12:08:17 +08:00
parent 99649bfdb8
commit c8a9d68933
14 changed files with 149 additions and 102 deletions

View File

@ -25,15 +25,6 @@ public class CollectionUtils {
return Arrays.stream(collections).anyMatch(CollectionUtil::isEmpty);
}
// TODO @puhui999 list.sort(); 可以替代呀;
public static <T, U extends Comparable<? super U>> List<T> sortedAsc(
Collection<T> from, Function<? super T, ? extends U> keyExtractor) {
// 按照升序排序
return from.stream()
.sorted(Comparator.comparing(keyExtractor))
.collect(Collectors.toList());
}
public static <T> boolean anyMatch(Collection<T> from, Predicate<T> predicate) {
return from.stream().anyMatch(predicate);
}