Here you can find the source of isEmpty(List
isEmpty(null) = true; isEmpty({}) = true; isEmpty({1}) = false;
Parameter | Description |
---|---|
V | a parameter |
sourceList | a parameter |
public static <V> boolean isEmpty(List<V> sourceList)
//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); } }