Java Collection Empty isEmpty(Collection collection)

Here you can find the source of isEmpty(Collection collection)

Description

is Empty

License

Open Source License

Return

((null == collection) || (0 == collection.size()))

Declaration

public static boolean isEmpty(Collection<?> collection) 

Method Source Code

//package com.java2s;
/* *******************************************************************
 * Copyright (c) 1999-2001 Xerox Corporation, 
 *               2002 Palo Alto Research Center, Incorporated (PARC).
 * All rights reserved. /*from   w  ww. j a  v a2  s  .com*/
 * This program and the accompanying materials are made available 
 * under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 *  
 * Contributors: 
 *     Xerox/PARC     initial implementation 
 * ******************************************************************/

import java.util.Collection;

import java.util.Map;

public class Main {
    /** @return ((null == s) || (0 == s.length())); */
    public static boolean isEmpty(String s) {
        return ((null == s) || (0 == s.length()));
    }

    /** @return ((null == ra) || (0 == ra.length)) */
    public static boolean isEmpty(Object[] ra) {
        return ((null == ra) || (0 == ra.length));
    }

    /** @return ((null == ra) || (0 == ra.length)) */
    public static boolean isEmpty(byte[] ra) {
        return ((null == ra) || (0 == ra.length));
    }

    /** @return ((null == collection) || (0 == collection.size())) */
    public static boolean isEmpty(Collection<?> collection) {
        return ((null == collection) || (0 == collection.size()));
    }

    /** @return ((null == map) || (0 == map.size())) */
    public static boolean isEmpty(Map<?, ?> map) {
        return ((null == map) || (0 == map.size()));
    }
}

Related

  1. isEmpty(Collection collection)
  2. isEmpty(Collection collection)
  3. isEmpty(Collection collection)
  4. isEmpty(Collection collection)
  5. isEmpty(Collection collection)
  6. isEmpty(Collection collection)
  7. isEmpty(Collection collection)
  8. isEmpty(Collection collection)
  9. isEmpty(Collection o)