Java Collection Empty isEmptyCollection(Object object)

Here you can find the source of isEmptyCollection(Object object)

Description

is Empty Collection

License

Apache License

Declaration

public static boolean isEmptyCollection(Object object) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static boolean isEmptyCollection(Object object) {
        if (object instanceof Collection<?>) {
            Collection<?> collection = (Collection<?>) object;
            return isEmpty(collection);
        } else {/*w w w.  jav  a2s. co  m*/
            return false;
        }
    }

    /**
     * Null-safe check if the specified collection is empty.
     * <p>
     * Null returns true.
     * 
     * @param coll the collection to check, may be null
     * @return true if empty or null
     */
    public static boolean isEmpty(Collection<?> coll) {
        return ((coll == null) || coll.isEmpty());
    }
}

Related

  1. isEmptyCollection(Collection collection)
  2. isEmptyCollection(Collection list)
  3. isEmptyCollection(Collection col)
  4. isEmptyCollection(Collection collection)
  5. isEmptyCollection(Object obj)
  6. isEmptyException(Collection collection)
  7. isEmptyNotesField(Collection col)
  8. isEmptyString(Collection theCollection)
  9. isNonEmpty(Collection coll)

  10. HOME | Copyright © www.java2s.com 2016