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 {
    /**
     * Check if the given Collection is null or empty
     * 
     * @param col
     * @return true if it is empty or null, otherwise false
     */
    public static boolean isEmpty(Collection<?> col) {
        return (col == null) || col.isEmpty();
    }

    /**
     * Check if the given Map is null or empty
     * 
     * @param map
     * @return true if it is empty or null, otherwise false
     */
    public static boolean isEmpty(Map<?, ?> map) {
        return (map == null) || map.isEmpty();
    }
}