com.github.sd4324530.fastweixin.util
类 CollectionUtil

java.lang.Object
  继承者 com.github.sd4324530.fastweixin.util.CollectionUtil

public final class CollectionUtil
extends Object

集合常用方法工具类

作者:
peiyu

方法摘要
static boolean isEmpty(Collection<?> collection)
          判断一个集合是否为空 null或者空集合都会返回true
static boolean isNotEmpty(Collection<?> collection)
          判断一个集合是否不为空
static
<T> ArrayList<T>
newArrayList()
          创建一个空集合
static
<T> ArrayList<T>
newArrayList(int initialCapacity)
          创建一个指定大小的集合
static
<T> ArrayList
newArrayList(T... ele)
          创建一个有默认内容的集合
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

isEmpty

public static boolean isEmpty(Collection<?> collection)
判断一个集合是否为空 null或者空集合都会返回true

参数:
collection - 需要判断的集合
返回:
是否有值,null或者空集合都是返回true

isNotEmpty

public static boolean isNotEmpty(Collection<?> collection)
判断一个集合是否不为空

参数:
collection - 需要判断的集合
返回:
是否不为空

newArrayList

public static <T> ArrayList<T> newArrayList()
创建一个空集合

类型参数:
T - 泛型
返回:
集合对象

newArrayList

public static <T> ArrayList<T> newArrayList(int initialCapacity)
创建一个指定大小的集合

类型参数:
T - 泛型
参数:
initialCapacity - 集合大小
返回:
集合对象

newArrayList

public static <T> ArrayList newArrayList(T... ele)
创建一个有默认内容的集合

类型参数:
T - 泛型
参数:
ele - 内容
返回:
集合对象


Copyright © 2017. All rights reserved.