Here you can find the source of isEmpty(Collection
Parameter | Description |
---|---|
T | the generic type |
collection | the collection |
public static <T> boolean isEmpty(Collection<T> collection)
//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(); } }