Java List Null Empty isEmpty(List sourceList)

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

Description

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

License

Apache License

Parameter

Parameter Description
V a parameter
sourceList a parameter

Return

if list is null or its size is 0, return true, else return false.

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    /**//from   w  w  w .  jav  a2 s  .  c  o  m
     * is null or its size is 0
     * 
     * <pre>
     * isEmpty(null)   =   true;
     * isEmpty({})     =   true;
     * isEmpty({1})    =   false;
     * </pre>
     * 
     * @param <V>
     * @param sourceList
     * @return if list is null or its size is 0, return true, else return false.
     */
    public static <V> boolean isEmpty(List<V> sourceList) {
        return (sourceList == null || sourceList.size() == 0);
    }
}

Related

  1. isEmpty(List obj)
  2. isEmpty(List list)
  3. isEmpty(List aList)
  4. isEmpty(List list)
  5. isEmpty(List objList)
  6. isEmptyList(List inputList)
  7. isEmptyList(List list)
  8. isHelp(List args, boolean valOnEmpty)
  9. isListElementsEmpty(final List l)