Is this list empty. - Android java.util

Android examples for java.util:List

Description

Is this list empty.

Demo Code


//package com.java2s;

import java.util.Collection;

public class Main {
    /**/*from w w w .j a  va  2s.  c  o  m*/
     * Is this list empty. Checks for null as well as size.
     *
     * @return true if empty, false if not
     */
    public static boolean isEmpty(Collection collection) {
        return collection == null || collection.isEmpty();
    }

    /**
     * Is this list empty. Checks for null as well as size.
     *
     * @return true if empty, false if not
     */
    public static boolean isEmpty(Object[] collection) {
        return collection == null || collection.length == 0;
    }
}

Related Tutorials