Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

import java.util.Map;

public class Main {
    public static boolean isAllEmpty(Collection<?>... collections) {
        if (collections == null) {
            return true;
        }

        for (Collection<?> collection : collections) {
            if (isNotEmpty(collection)) {
                return false;
            }
        }

        return true;
    }

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

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

        return true;
    }

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

    public static boolean isNotEmpty(Collection<?> collection) {
        return (collection != null) && (collection.size() > 0);
    }
}