Java Collection Empty isNullOrEmpty(Collection obj)

Here you can find the source of isNullOrEmpty(Collection obj)

Description

Checks if is null or empty.

License

Open Source License

Parameter

Parameter Description
obj the obj

Return

true, if is null or empty

Declaration

public static boolean isNullOrEmpty(Collection<?> obj) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

import java.util.Map;

public class Main {
    /**/*w w w .j  a v a 2s . co m*/
     * Checks if is null or empty.
     *
     * @param value
     *            the value
     * @return true, if is null or empty
     */
    public static boolean isNullOrEmpty(String value) {
        return (value == null || value.length() <= 0);
    }

    /**
     * Checks if is null or empty.
     *
     * @param obj
     *            the obj
     * @return true, if is null or empty
     */
    public static boolean isNullOrEmpty(Collection<?> obj) {
        return (obj == null || obj.isEmpty());
    }

    /**
     * Checks if is null or empty.
     *
     * @param map
     *            the map
     * @return true, if is null or empty
     */
    public static boolean isNullOrEmpty(Map<?, ?> map) {
        return (map == null || map.isEmpty());
    }
}

Related

  1. isNullOrEmpty(Collection collection)
  2. isNullOrEmpty(Collection collection)
  3. isNullOrEmpty(Collection col)
  4. isNullOrEmpty(Collection collection)
  5. isNullOrEmpty(Collection list)
  6. isNullOrEmpty(Collection s)
  7. isNullOrEmpty(Collection values)
  8. isNullOrEmpty(final Collection c)
  9. isNullOrEmpty(final Collection collection)