is Map Empty - Java java.util

Java examples for java.util:Map Entry

Description

is Map Empty

Demo Code


//package com.java2s;

import java.util.Collection;

import java.util.Map;

public class Main {
    public static void main(String[] argv) {
        Collection collection = java.util.Arrays.asList("asdf",
                "java2s.com");
        System.out.println(isEmpty(collection));
    }//  w w  w.j  a  v a 2s .co  m

    public static boolean isEmpty(Collection collection) {
        return collection == null || collection.isEmpty();
    }

    public static boolean isEmpty(Map map) {
        return map == null || map.isEmpty();
    }

    public static boolean isEmpty(Object[] objects) {
        return objects == null || objects.length == 0;
    }
}

Related Tutorials