Java Array Empty Check isEmpty(Object[] array)

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

Description

is Empty

License

Open Source License

Declaration

public static boolean isEmpty(Object[] array) 

Method Source Code

//package com.java2s;
/**//from ww w.  j a v a 2  s  . co  m
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library 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 Lesser General Public License for more
 * details.
 */

import java.util.Collection;
import java.util.List;
import java.util.Set;

public class Main {
    public static boolean isEmpty(Collection<?> collection) {
        if ((collection == null) || collection.isEmpty()) {
            return true;
        }

        return false;
    }

    public static boolean isEmpty(List<?> list) {
        if ((list == null) || list.isEmpty()) {
            return true;
        }

        return false;
    }

    public static boolean isEmpty(Object[] array) {
        if ((array == null) || (array.length == 0)) {
            return true;
        }

        return false;
    }

    public static boolean isEmpty(Set<?> set) {
        if ((set == null) || set.isEmpty()) {
            return true;
        }

        return false;
    }
}

Related

  1. isEmpty(Object[] array)
  2. isEmpty(Object[] array)
  3. isEmpty(Object[] array)
  4. isEmpty(Object[] array)
  5. isEmpty(Object[] array)
  6. isEmpty(Object[] array)
  7. isEmpty(Object[] array)
  8. isEmpty(Object[] array)
  9. isEmpty(Object[] array)