Example usage for java.util Collection size

List of usage examples for java.util Collection size

Introduction

In this page you can find the example usage for java.util Collection size.

Prototype

int size();

Source Link

Document

Returns the number of elements in this collection.

Usage

From source file:Main.java

public static boolean isNotEmptyList(Collection list) {
    return list != null && list.size() > 0;
}

From source file:Main.java

public static boolean isEmpty(Collection<?> c) {
    return c == null || c.size() == 0;
}

From source file:Main.java

public static <T> T[] convertArrayToList(Collection<T> list) {
    return (T[]) (list.size() > 0
            ? list.toArray((Object[]) Array.newInstance(list.iterator().next().getClass(), list.size()))
            : null);/*from  w  w w  .j a v a  2 s  .c  om*/
}

From source file:Main.java

public final static int size(Collection c) {
    return c == null ? 0 : c.size();
}

From source file:Main.java

public static boolean isEmpty(Collection<?> c) {
    if (null == c || c.size() == 0) {
        return true;
    }//from w  w w .j a  v a 2  s  .c  o  m
    return false;
}

From source file:Main.java

public static <T> boolean isSubsetOf(Collection<T> a, Collection<T> b) {
    return (a.size() <= b.size()) && (b.containsAll(a));
}

From source file:Main.java

public static int size(Collection<?> c) {
    return (c == null) ? 0 : c.size();
}

From source file:Main.java

public static boolean isEmpty(Collection col) {
    if (col == null || col.size() == 0) {
        return true;
    } else {/*from  w  ww. j a  va  2  s. c  o  m*/
        return false;
    }
}

From source file:Main.java

public static boolean isEmpty(Collection<?> obj) {
    return (obj == null || obj.size() == 0) ? true : false;
}

From source file:Main.java

public static <E> boolean isEmpty(Collection<E> c) {
    return c == null || c.size() == 0;

}