A method to check whether the map is empty or not. - Java java.util

Java examples for java.util:Map Operation

Description

A method to check whether the map is empty or not.

Demo Code


//package com.java2s;

import java.util.Map;

public class Main {
    /**/*w  ww.j a  v a2s . c om*/
     * <p>
     * A method to check whether the <tt>map</tt> is empty or not.
     *</p>
     *
     *
     * @param mapToCheck
     *       a <tt>Map</tt> which needs to be checked
     *
     * @return
     *       a boolean value (true/false) indicating the status
     */
    public static boolean isEmptyMap(
            Map<? extends Object, ? extends Object> mapToCheck) {
        return (mapToCheck.size() <= 0);
    }
}

Related Tutorials