mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-23 23:09:47 +08:00
fix 修复 StreamUtils 返回不可变类型报错问题
This commit is contained in:
@ -27,7 +27,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E> List<E> filter(Collection<E> collection, Predicate<E> function) {
|
public static <E> List<E> filter(Collection<E> collection, Predicate<E> function) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(function)
|
.filter(function)
|
||||||
@ -127,7 +127,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E> List<E> sorted(Collection<E> collection, Comparator<E> comparing) {
|
public static <E> List<E> sorted(Collection<E> collection, Comparator<E> comparing) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -265,7 +265,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, T> List<T> toList(Collection<E> collection, Function<E, T> function) {
|
public static <E, T> List<T> toList(Collection<E> collection, Function<E, T> function) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.map(function)
|
.map(function)
|
||||||
|
Reference in New Issue
Block a user