Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.*;

public class Main {

    public static boolean isNotEmpty(Collection<?>... colls) {
        return !isEmpty(colls);
    }

    public static boolean isNotEmpty(Map<?, ?>... maps) {
        return !isEmpty(maps);
    }

    public static final boolean isNotEmpty(Collection<?> c) {
        return null != c && !c.isEmpty();
    }

    @SuppressWarnings("unchecked")
    public static final boolean isEmpty(Collection c) {
        return null == c || 0 == c.size() ? true : false;
    }

    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;
    }
}