List of usage examples for java.util Collection isEmpty
boolean isEmpty();
From source file:Main.java
/** * return collection is empty//from w w w . j a v a2 s . c o m * @param c * @return */ public static <E> boolean isEmpty(Collection<E> c) { return (null == c || c.isEmpty()); }
From source file:Main.java
/** Returns a new array or null if collection is empty */ public static <T> T[] toArray(Collection<T> c) { return c.isEmpty() ? null : toArray(c, c.iterator().next().getClass()); }
From source file:Main.java
public static boolean isEmpty(Collection<?> collection) { return (collection == null) || collection.isEmpty(); }
From source file:Main.java
/** * Returns the first item in the collection or null if the collection is empty *///from w ww .j ava2s . co m public static <X> X getFirstItem(Collection<X> c) { X o; if (c == null || c.isEmpty()) { o = null; } else if (c instanceof List) { o = ((List<X>) c).get(0); } else { o = c.iterator().next(); } return o; }
From source file:Main.java
static boolean isEmpty(final Collection<?> collection) { return collection == null || collection.isEmpty(); }
From source file:Main.java
public static boolean isEmptyOrNull(Collection<?> collection) { return null == collection || collection.isEmpty(); }
From source file:Main.java
public static boolean isNotEmptyOrNull(Collection<?> collection) { return null != collection && !collection.isEmpty(); }
From source file:Main.java
public static <T> boolean isEmpty(Collection<? extends T> collections) { return collections == null || collections.isEmpty(); }
From source file:Main.java
public static Boolean isEmpty(Collection<?> collection) { return (collection == null || collection.isEmpty()); }
From source file:Main.java
/** * //from ww w. j a va 2 s .c o m * @Title: isEmpty * @author: wuwh * * <p>check collection is empty</p> * * <pre> * CollectionUtil.isEmpty(null) = true * Map.put("ddd","ddd"); * CollectionUtil.isEmpty(Map)=false * </pre> * */ public static boolean isEmpty(Collection collection) { return null != collection && !collection.isEmpty() ? false : true; }