类 CollectionTool


  • public class CollectionTool
    extends Object
    作者:
    woodwhales on 2020-12-07
    • 方法详细资料

      • difference

        public static <E> Set<E> difference​(Set<E> set1,
                                            Set<E> set2)
        set1 和 set2 集合进行差集运算
        类型参数:
        E - 数据泛型
        参数:
        set1 - 集合1
        set2 - 集合2
        返回:
        set
      • toSet

        public static <T,​R> Set<R> toSet​(Set<T> set,
                                               java.util.function.Function<T,​R> function)
        从原始 set 集合生成新的 set
        类型参数:
        T - 源数据类型
        R - 目标数据类型
        参数:
        set - 源数据集合
        function - 生成新的 set 集合接口
        返回:
        set