List of usage examples for java.util Collection isEmpty
boolean isEmpty();
From source file:Main.java
/** * Null-safe check if the specified collection is empty. * /*from www .j a v a2 s .com*/ * @param coll the collection to check, may be null * @return true if empty or null */ public static boolean isEmpty(Collection<?> coll) { return (coll == null || coll.isEmpty()); }
From source file:Main.java
public static boolean isNotEmpty(Collection collection) { return (collection != null) && !(collection.isEmpty()); }
From source file:Main.java
public static <T> boolean containsByValue(Collection<? extends T> c, T item) { if (c == null || c.isEmpty()) return false; for (T i : c) { if (i.equals(item)) return true; }//w w w.ja v a2 s.com return false; }
From source file:Main.java
public static boolean isEmpty(Collection c) { return (c == null || c.isEmpty()); }
From source file:Main.java
public static boolean isEmpty(Collection<?> theCollection) { return theCollection == null || theCollection.isEmpty(); }
From source file:Main.java
private static <E> boolean isEmpty(Collection<E> collection) { return (collection == null || collection.isEmpty()); }
From source file:Main.java
public static boolean isEmpty(Collection<?> coll) { return (null == coll || coll.isEmpty()); }
From source file:Main.java
public static boolean isNotEmpty(Collection<?> col) { return col != null && !col.isEmpty(); }
From source file:Main.java
public static boolean empty(Collection<?> collection) { return collection == null || collection.isEmpty(); }
From source file:Main.java
/** * Implementation of the OCL//from w w w.jav a 2s. c om * <ul> * <li><tt>OrderedSet::first() : T</tt></li> * <li><tt>Sequence::first() : T</tt></li> * </ul> * operations. * * @param self the source collection * @return the first object of the source collection */ public static <E> E first(Collection<E> self) { if (self.isEmpty()) { return null; // undefined } return self.iterator().next(); }