Example usage for java.util List isEmpty

List of usage examples for java.util List isEmpty

Introduction

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

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this list contains no elements.

Usage

From source file:Main.java

public static boolean isEmpty(List<?> list) {
    if (list == null || list.isEmpty()) {
        return true;
    }/*from   w w  w .  j  av  a2 s . c  om*/
    return false;
}

From source file:Main.java

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

From source file:Main.java

public static <K> K getGenericList(List<K> result) {
    if (result == null || result.isEmpty()) {
        return null;
    } else {/*  w  w  w  .  ja  v a 2 s  . c om*/
        return result.stream().findAny().get();
    }
}

From source file:Main.java

public static <T> boolean isEmptyList(final List<T> list) {
    return list == null || list.isEmpty();
}

From source file:Main.java

public static <T> boolean isEmpty(List<T> l) {
    return l == null || l.isEmpty();
}

From source file:Main.java

/**
 * //w  w w .j a  va2 s .com
 * @param list
 * @return
 */
public static boolean isListBlank(List<?> list) {
    return (list == null) || (list.isEmpty());
}

From source file:Main.java

public static <T> T last(List<T> list) {
    return list != null && !list.isEmpty() ? list.get(list.size() - 1) : null;
}

From source file:Main.java

/**
 * Convert to Set - this operation removes the duplicates in original list.
 * @param list//  www  .j  a v a  2s .c  o  m
 * @return
 */
public static <T> Set<T> converToSet(List<T> list) {
    if (list == null || list.isEmpty()) {
        return Collections.emptySet();
    }
    return new HashSet<T>(list);
}

From source file:Main.java

public static boolean isListNotEmpty(List list) {
    return list != null && !list.isEmpty();
}

From source file:Main.java

public static Double listMin(List<Double> list) {
    if (list == null || list.isEmpty()) {
        return null;
    }/*  ww w  .j a v a  2  s .  c  o m*/

    return Collections.min(list);
}