Java Collection Empty isEmpty(Collection c)

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

Description

is Empty

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
public static final boolean isEmpty(Collection c) 

Method Source Code


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

import java.util.*;

public class Main {

    @SuppressWarnings("unchecked")
    public static final boolean isEmpty(Collection c) {
        return null == c || 0 == c.size() ? true : false;
    }/*  w  w w  .  j a v  a2s .  c  o  m*/

    public static boolean isEmpty(Collection<?>... colls) {
        boolean result = false;

        for (Collection<?> coll : colls) {
            if (null == coll || coll.isEmpty()) {
                result = true;
                break;
            }
        }

        return result;
    }

    public static boolean isEmpty(Map<?, ?>... maps) {
        boolean result = false;

        for (Map<?, ?> map : maps) {
            if (null == map || map.isEmpty()) {
                result = true;
                break;
            }
        }

        return result;
    }
}

Related

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