Example usage for java.util List size

List of usage examples for java.util List size

Introduction

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

Prototype

int size();

Source Link

Document

Returns the number of elements in this list.

Usage

From source file:Main.java

public static <T> T atOrNull(List<T> list, int index) {
    if (list.size() <= index)
        return null;
    return list.get(index);
}

From source file:Main.java

public static boolean isEmpty(List list) {
    return list == null || list.size() <= 0;
}

From source file:Main.java

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

From source file:Main.java

public static <I> boolean isNotEmpty(List<I> xs) {
    return xs != null && xs.size() > 0;
}

From source file:Main.java

public static <T> boolean listNotNull(List<T> t) {
    if (t != null && t.size() > 0) {
        return true;
    } else {/*from  w ww.  j  a va 2  s  .  co m*/
        return false;
    }
}

From source file:Main.java

public static <T> boolean isListEmpty(List<T> list) {
    return list == null || list.size() <= 0;
}

From source file:Main.java

public static <E> boolean isSublistOf(List<E> bigger, List<E> smaller) {
    if (smaller.size() > bigger.size())
        return false;
    for (int start = 0; start + smaller.size() <= bigger.size(); ++start) {
        List<E> sublist = bigger.subList(start, start + smaller.size());
        if (sublist.equals(bigger)) {
            return true;
        }//  ww w  . java2  s. c o m
    }
    return false;
}

From source file:Main.java

public static boolean isListEmpty(List<?> list) {
    return list == null || list.size() == 0;
}

From source file:Main.java

public static boolean isListAvailable(List<?> list) {
    return list != null && list.size() > 0;
}

From source file:Main.java

public static boolean hasElem(List list) {
    if (list != null && list.size() > 0) {
        return true;
    }//from   w ww .j  a v a 2 s.  c  o m
    return false;
}