List of usage examples for java.util Collection size
int size();
From source file:Main.java
public static boolean isNotEmpty(Collection<?> coll) { return coll != null && coll.size() != 0; }
From source file:Main.java
public static <T> boolean isNotEmpty(Collection<T> list) { return list != null && list.size() > 0; }
From source file:Main.java
public static String collection2str(Collection<?> c) { if (c.size() == 0) return "[]"; StringBuilder result = new StringBuilder("["); for (Object elem : c) { if (c.size() != 1) result.append("\n "); result.append(elem);//from ww w .ja v a 2s . c om } if (c.size() != 1) result.append("\n"); result.append("]"); return result.toString(); }
From source file:Main.java
public static <T> boolean isEmpty(Collection<T> list) { return list == null || list.size() == 0; }
From source file:Main.java
public static <T> T uniqueResult(final Collection<T> c) { switch (c.size()) { case 0://from w ww. j a v a 2 s .c o m return null; case 1: return c.iterator().next(); default: throw new IllegalStateException("Unexpected number of elements in collection: " + c.size()); } }
From source file:Main.java
public static boolean isEmpty(Collection col) { return col == null || col.size() == 0; }
From source file:Main.java
public static int size(Collection col) { return (col != null) ? col.size() : 0; }
From source file:Main.java
public static boolean isEmpty(Collection<?> list) { if (list == null || list.size() <= 0) return true; else/*from www .j a v a2 s . com*/ return false; }
From source file:Main.java
public static <E> int size(Collection<E> c) { return c == null ? 0 : c.size(); }
From source file:Main.java
public static Boolean isEmpty(Collection c) { if (c == null || c.size() < 1) { return true; }//w ww . ja va2s . co m return false; }