Class SetUtils

java.lang.Object
io.github.seenings.core.util.SetUtils

public class SetUtils extends Object
SetUtils
Since:
2022-10-23
Author:
chixuehui
  • Constructor Details

    • SetUtils

      public SetUtils()
  • Method Details

    • except

      public static <T> Set<T> except(Set<T> firstSet, Set<T> secondSet)
      差集,在第一个列表中,但不在第二个列表中
      Type Parameters:
      T - 元素类型
      Parameters:
      firstSet - 第一个列表
      secondSet - 第二个列表
      Returns:
      列表
    • union

      public static <T> Set<T> union(Collection<T> firstSet, Collection<T> secondSet)
      并集,相同元素去重
      Type Parameters:
      T - 元素类型
      Parameters:
      firstSet - 第一个列表
      secondSet - 第二个列表
      Returns:
      列表
    • interset

      public static <T> Set<T> interset(Set<T> firstSet, Set<T> secondSet)
      交集,获取相同元素
      Type Parameters:
      T - 元素类型
      Parameters:
      firstSet - 第一个列表
      secondSet - 第二个列表
      Returns:
      列表