Java Collection Empty isEmpty(Collection col)

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

Description

is Empty

License

Open Source License

Declaration

public static boolean isEmpty(Collection<?> col) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Salesforce.com, inc..
 * All rights reserved. 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
 * /*from w  ww .  j  a v  a 2s  .  co  m*/
 * Contributors:
 *     Salesforce.com, inc. - initial API and implementation
 ******************************************************************************/

import java.util.Collection;

import java.util.List;

import java.util.Map;

public class Main {
    public static boolean isEmpty(Object obj) {
        return null == obj;
    }

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

    public static boolean isEmpty(byte[] objs) {
        return objs == null || objs.length == 0;
    }

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

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

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

    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }
}

Related

  1. isEmpty(Collection v)
  2. isEmpty(Collection col)
  3. isEmpty(Collection c)
  4. isEmpty(Collection c)
  5. isEmpty(Collection c)
  6. isEmpty(Collection col)
  7. isEmpty(Collection collection)
  8. isEmpty(Collection collection)
  9. isEmpty(Collection collection)