Class Sets

  • Direct Known Subclasses:
    W.S

    public class Sets
    extends java.lang.Object
    Set的帮助类,获得Set的一些操作
    Author:
    WD
    • Constructor Summary

      Constructors 
      Constructor Description
      Sets()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> java.util.Set<E> emptySet()
      获得一个不可变的空Set
      static boolean isSet​(java.lang.Object obj)
      判断是否Set
      static <E> java.util.HashSet<E> newSet()
      获得Set实例 实现类是HashSet 默认初始化大小为10
      static <E> java.util.HashSet<E> newSet​(int size)
      获得Set实例 实现类是HashSet
      static <E> java.util.HashSet<E> newSet​(E... es)
      获得Set实例 实现类是HashSet
      static <E> java.util.HashSet<E> newSet​(java.util.Collection<E> c)
      获得Set实例 实现类是HashSet
      static int size​(java.util.Set<?> set)
      获得列表数量
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Sets

        public Sets()
    • Method Detail

      • isSet

        public static boolean isSet​(java.lang.Object obj)
        判断是否Set
        Parameters:
        obj - 对象
        Returns:
        是否Set
      • newSet

        public static <E> java.util.HashSet<E> newSet()
        获得Set实例 实现类是HashSet 默认初始化大小为10
        Type Parameters:
        E - 泛型
        Returns:
        Set
      • newSet

        public static <E> java.util.HashSet<E> newSet​(int size)
        获得Set实例 实现类是HashSet
        Type Parameters:
        E - 泛型
        Parameters:
        size - 初始化大小
        Returns:
        Set
      • newSet

        @SafeVarargs
        public static <E> java.util.HashSet<E> newSet​(E... es)
        获得Set实例 实现类是HashSet
        Type Parameters:
        E - 泛型
        Parameters:
        es - 初始化的集合
        Returns:
        Set
      • newSet

        public static <E> java.util.HashSet<E> newSet​(java.util.Collection<E> c)
        获得Set实例 实现类是HashSet
        Type Parameters:
        E - 泛型
        Parameters:
        c - 初始化的集合
        Returns:
        Set
      • emptySet

        public static <E> java.util.Set<E> emptySet()
        获得一个不可变的空Set
        Type Parameters:
        E - 泛型
        Returns:
        一个不可变的空Set
      • size

        public static int size​(java.util.Set<?> set)
        获得列表数量
        Parameters:
        set - 数据列表
        Returns:
        数量