Android List Empty Check isEmpty(List list)

Here you can find the source of isEmpty(List list)

Description

Returns true if list is null or its size is 0
 isEmpty(null)   =   true; isEmpty({})     =   true; isEmpty({1})    =   false; 

Parameter

Parameter Description
V < >
list - of List type.

Return

boolean - true if list is null or empty, else false.

Declaration

public static <V> boolean isEmpty(List<V> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**//  w  w  w . j  a  v a  2 s . com
     * Returns true if list is null or its size is 0
     * 
     * <pre>
     * isEmpty(null)   =   true;
     * isEmpty({})     =   true;
     * isEmpty({1})    =   false;
     * </pre>
     * 
     * @param <V>
     * @param list - of {@link List} type.
     * @return boolean - true if list is null or empty, else false.
     */
    public static <V> boolean isEmpty(List<V> list) {
        return (list == null || list.size() == 0);
    }
}