Java Array Empty Check isNullOrEmpty(Object[] array)

Here you can find the source of isNullOrEmpty(Object[] array)

Description

is Null Or Empty

License

Open Source License

Declaration

public static boolean isNullOrEmpty(Object[] array) 

Method Source Code

//package com.java2s;
/*/* w  ww  . jav a2s  .  c  o m*/
 *        _____                     __    _     _   _____ _
 *       |   __|___ ___ _ _ ___ ___|  |  |_|___| |_|  _  | |_ _ ___
 *       |__   | -_|  _| | | -_|  _|  |__| |_ -|  _|   __| | | |_ -|
 *       |_____|___|_|  \_/|___|_| |_____|_|___|_| |__|  |_|___|___|
 *
 *  ServerListPlus - http://git.io/slp
 *    > The most customizable server status ping plugin for Minecraft!
 *  Copyright (c) 2014, Minecrell <https://github.com/Minecrell>
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Collection;

import java.util.Iterator;

import java.util.Map;

public class Main {
    public static boolean isNullOrEmpty(Object[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNullOrEmpty(Iterator<?> iterator) {
        return iterator == null || !iterator.hasNext();
    }

    public static boolean isNullOrEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

    public static boolean isNullOrEmpty(Map<?, ?> map) {
        return map == null || map.isEmpty();
    }
}

Related

  1. isNotEmpty(T[] array)
  2. isNotEmpty(T[] array)
  3. isNotEmpty(T[] array)
  4. isNotNullAndNotEmpty(final Object[] array)
  5. isNotNullOrEmpty(T[] array)
  6. isNullOrEmpty(String[] s)
  7. isNullOrEmpty(T[] array)
  8. isNullOrEmptyOrFirstElementBlank(String[] values)
  9. normalizeTokens(String[] tokens, boolean removeEmpty)