List of usage examples for java.util Collection size
int size();
From source file:Main.java
public static boolean isEmpty(Collection<?> c) { if (c == null || c.size() == 0) { return true; } else {//from w w w . j a v a 2 s . co m return false; } }
From source file:Main.java
public static boolean isCollectionNotEmpty(Collection<?> collection) { if (collection != null && collection.size() > 0) { return true; }//from ww w . ja v a 2s. co m return false; }
From source file:Main.java
public static int size(Collection<?> collection) { return collection == null ? 0 : collection.size(); }
From source file:Main.java
public static boolean isListNotEmpty(Collection<?> collection) { if (collection != null && collection.size() > 0) { return true; }/* w ww.java 2s. co m*/ return false; }
From source file:Main.java
/** Convert a Collection of Strings to a plain array String[]. */ public static String[] unboxStrings(Collection<String> coll) { return coll.toArray(new String[coll.size()]); }
From source file:Main.java
/** * Returns the size of the specified collection or {@code 0} if the * collection is {@code null}.//from w w w.j av a 2 s .co m * * @param c * the collection to check * @return the size of the specified collection or {@code 0} if the * collection is {@code null}. * @since 1.2 */ public static int size(Collection c) { return c != null ? c.size() : 0; }
From source file:Main.java
public static boolean isEmpty(Collection collection) { return null == collection || 0 == collection.size(); }
From source file:Main.java
public static boolean isEmpty(Collection collection) { return collection == null || collection.size() == 0; }
From source file:Main.java
public static boolean isEmpty(Collection collection) { return (collection == null || collection.size() == 0); }
From source file:Main.java
public static <T> T getSoleElement(final Collection<T> items) { if (items.size() != 1) throw new IllegalArgumentException( String.format("Expected a single element in %s, but found %s.", items, items.size())); return items.iterator().next(); }