Here you can find the source of isNotEmpty(List
Parameter | Description |
---|---|
E | a parameter |
list | the list to check |
public static <E> boolean isNotEmpty(List<E> list)
//package com.java2s; //License from project: Open Source License import java.util.List; import java.util.Set; public class Main { /**// www.java 2 s . co m * Check if set isn't empty. * * @param set * The set to be tested. * @return <code>true</code> is not empty, <code>false</code> otherwise. */ public static <E> boolean isNotEmpty(Set<E> set) { return set != null && !set.isEmpty(); } /** * This method checks if the list is not null and have elements. * * @param <E> * * @param list * the list to check * @return true/false */ public static <E> boolean isNotEmpty(List<E> list) { return list != null && !list.isEmpty(); } /** * This method checks if the list is not null and have elements. * * @param <E> * * @param list * the list to check * @return true/false */ public static <E> boolean isNotEmpty(E[] list) { return list != null && list.length > 0; } /** * Check if set is empty. * * @param set * @return */ public static <E> boolean isEmpty(Set<E> set) { return !isNotEmpty(set); } public static <E> boolean isEmpty(List<E> list) { return !isNotEmpty(list); } public static <E> boolean isEmpty(E[] list) { return !isNotEmpty(list); } }