疯狂的狮子li
2023-03-30 1ed1752f678f769e43e9faa34809701850c7f727
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StreamUtils.java
@@ -30,7 +30,8 @@
        if (CollUtil.isEmpty(collection)) {
            return CollUtil.newArrayList();
        }
        return collection.stream().filter(function).toList();
        // 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
        return collection.stream().filter(function).collect(Collectors.toList());
    }
    /**
@@ -41,7 +42,7 @@
     * @return 拼接后的list
     */
    public static <E> String join(Collection<E> collection, Function<E, String> function) {
        return join(collection, function, ",");
        return join(collection, function, StringUtils.SEPARATOR);
    }
    /**
@@ -70,7 +71,8 @@
        if (CollUtil.isEmpty(collection)) {
            return CollUtil.newArrayList();
        }
        return collection.stream().sorted(comparing).toList();
        // 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
        return collection.stream().sorted(comparing).collect(Collectors.toList());
    }
    /**
@@ -188,7 +190,8 @@
            .stream()
            .map(function)
            .filter(Objects::nonNull)
            .toList();
            // 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
            .collect(Collectors.toList());
    }
    /**