Java Collection Empty isAnyEmpty(Collection... collections)

Here you can find the source of isAnyEmpty(Collection... collections)

Description

is Any Empty

License

Open Source License

Declaration

public static boolean isAnyEmpty(Collection<?>... collections) 

Method Source Code

//package com.java2s;

import java.util.Collection;

import java.util.Map;

public class Main {
    public static boolean isAnyEmpty(Collection<?>... collections) {
        if (collections == null) {
            return true;
        }/*from  w  w w . j  a  v a  2 s .c o  m*/

        for (Collection<?> collection : collections) {
            if (isEmpty(collection)) {
                return true;
            }
        }

        return false;
    }

    public static boolean isAnyEmpty(Map<?, ?>... maps) {
        if (maps == null) {
            return true;
        }

        for (Map<?, ?> map : maps) {
            if (isEmpty(map)) {
                return true;
            }
        }

        return false;
    }

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

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

Related

  1. emptyToNull(final Collection value)
  2. getSingletonCollectionOrEmptyIfNull(T o)
  3. isCollectionEmpty(Collection collection)
  4. isCollectionEmpty(Collection oneCol)
  5. isCollectionEmpty(Collection value)
  6. isCollectionNotEmpty(Collection collection)