Java Collection Empty isEmpty(Collection collection)

Here you can find the source of isEmpty(Collection collection)

Description

Check if the collection is empty.

License

Open Source License

Parameter

Parameter Description
collection a parameter

Declaration

public static boolean isEmpty(Collection<?> collection) 

Method Source Code


//package com.java2s;

import java.util.Collection;

import java.util.Map;

public class Main {
    /**/*from  www  .j  av a2 s  .c o m*/
     * Check if the collection is empty.
     * 
     * @param collection
     * @return
     */
    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.size() == 0;
    }

    /**
     * Check if the map is empty.
     * 
     * @param map
     * @return
     */
    public static boolean isEmpty(Map<?, ?> map) {
        return map == null || map.size() == 0;
    }
}

Related

  1. isEmpty(Collection collection)
  2. isEmpty(Collection collection)
  3. isEmpty(Collection collection)
  4. isEmpty(Collection collection)
  5. isEmpty(Collection collection)
  6. isEmpty(Collection o)
  7. isEmpty(Collection objs)
  8. isEmpty(Collection value)
  9. isEmpty(Collection values)