Here you can find the source of isEmpty(Collection> collection)
public static <T extends Collection<?>> boolean isEmpty(Collection<?> collection)
//package com.java2s; /*/* w ww . j av a2s. c o m*/ * Copyright (c) 2007, 2011-2013, 2015, 2016 Eike Stepper (Berlin, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Eike Stepper - initial API and implementation * Christian W. Damus (CEA LIST) - bug 418454 */ import java.util.Collection; import java.util.Map; public class Main { /** * @since 3.1 */ public static <T> boolean isEmpty(T[] array) { return array == null || array.length == 0; } /** * @since 3.1 */ public static <T extends Map<?, ?>> boolean isEmpty(Map<?, ?> map) { return map == null || map.isEmpty(); } /** * @since 3.1 */ public static <T extends Collection<?>> boolean isEmpty(Collection<?> collection) { return collection == null || collection.isEmpty(); } /** * @since 3.1 */ public static boolean isEmpty(String string) { return string == null || string.length() == 0; } }