营销:装修页面适配

This commit is contained in:
owen
2023-11-03 09:18:04 +08:00
parent 9996608da6
commit bdfb5b8894
6 changed files with 24 additions and 13 deletions

View File

@ -223,10 +223,14 @@ public class CollectionUtils {
}
public static <T> T findFirst(List<T> from, Predicate<T> predicate) {
return findFirst(from, predicate, Function.identity());
}
public static <T, U> U findFirst(List<T> from, Predicate<T> predicate, Function<T, U> func) {
if (CollUtil.isEmpty(from)) {
return null;
}
return from.stream().filter(predicate).findFirst().orElse(null);
return from.stream().filter(predicate).findFirst().map(func).orElse(null);
}
public static <T, V extends Comparable<? super V>> V getMaxValue(Collection<T> from, Function<T, V> valueFunc) {