Java Collection Empty isEmpty(Collection collection)

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

Description

Checks if is empty.

License

Open Source License

Parameter

Parameter Description
T the generic type
collection the collection

Return

true, if is empty Null safe False if the collection passed in is null

Declaration

public static <T> boolean isEmpty(Collection<T> collection) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *******************************************************************************/

import java.util.Collection;

public class Main {
    /**/*from w w  w .j a  v  a 2s .c  o m*/
     * Checks if is empty.
     *
     * @param <T> the generic type
     * @param collection the collection
     * @return true, if is empty
     * Null safe
     * False if the collection passed in is null
     */
    public static <T> boolean isEmpty(Collection<T> collection) {
        return collection == null || collection.isEmpty();
    }
}

Related

  1. isEmpty(Collection objectCollection)
  2. isEmpty(Collection c)
  3. isEmpty(Collection c)
  4. isEmpty(Collection collection)
  5. isEmpty(Collection collection)
  6. isEmpty(Collection collection, String messgae)
  7. isEmpty(Collection items)
  8. isEmpty(Collection c)
  9. isEmpty(final Collection values)

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