Java List Null Empty isEmpty(List objList)

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

Description

This function checks if the list of the objects is empty

License

Open Source License

Parameter

Parameter Description
objList a parameter

Declaration

public static <T> boolean isEmpty(List<T> objList) 

Method Source Code

//package com.java2s;
/*/*  ww  w.j  av  a2s.  c om*/
 * Copyright (c) 2012 CitrusPay. All Rights Reserved.
 *
 * This software is the proprietary information of CitrusPay.
 * Use is subject to license terms.
 */

import java.util.List;

public class Main {
    /**
     * This function checks if the string is null or empty. returns true if string is not null but empty.
     * @param str
     * @return
     */
    public static boolean isEmpty(String str) {
        if (str == null || str.length() <= 0) {
            return true;
        }
        return false;
    }

    /**
     * This function checks if the list of the objects is empty
     * @param objList
     * @return
     */
    public static <T> boolean isEmpty(List<T> objList) {
        return (isNull(objList) || (objList.size() == 0));
    }

    /**
     * This function checks if object is null
     * @param object
     * @return
     */

    public static boolean isNull(Object object) {
        return (object == null) ? Boolean.TRUE : Boolean.FALSE;
    }
}

Related

  1. isEmpty(List list, String message)
  2. isEmpty(List obj)
  3. isEmpty(List list)
  4. isEmpty(List aList)
  5. isEmpty(List list)
  6. isEmpty(List sourceList)
  7. isEmptyList(List inputList)
  8. isEmptyList(List list)
  9. isHelp(List args, boolean valOnEmpty)