Java Collection Empty isEmpty(final Collection value)

Here you can find the source of isEmpty(final Collection value)

Description

Tests given value to see if it is empty.

License

Open Source License

Parameter

Parameter Description
value Value to test. Does not check to see if it is null.

Return

True if empty.

Declaration

public static boolean isEmpty(final Collection<?> value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    /**/*w  w  w .j  a  va  2  s. com*/
     * Tests given value to see if it is empty.
     * 
     * @param value
     *            Value to test. Does not check to see if it is null.
     * @return True if empty.
     */
    public static boolean isEmpty(final Collection<?> value) {

        return 0 == value.size();
    }

    /**
     * Tests given value to see if it is empty.
     * 
     * @param value
     *            Value to test. Does not check to see if it is null.
     * @return True if empty.
     */
    public static boolean isEmpty(final Object[] value) {

        return 0 == value.length;
    }

    /**
     * Tests given value to see if it is empty.
     * 
     * @param value
     *            Value to test. Does not check to see if it is null.
     * @return True if empty.
     */
    public static boolean isEmpty(final String value) {

        return 0 == value.length();
    }
}

Related

  1. isEmpty(final Collection coll)
  2. isEmpty(final Collection collection)
  3. isEmpty(final Collection collection)
  4. isEmpty(final Collection collection)
  5. isEmpty(final Collection collection)
  6. isEmpty(final Collection c)
  7. isEmpty(final Collection c)
  8. isEmpty(final Collection collection)
  9. isEmpty(final Collection source)