Here you can find the source of isEmpty(T[] array)
Parameter | Description |
---|---|
array | The array to test. |
public static <T extends Object> boolean isEmpty(T[] array)
//package com.java2s; /*/*from w w w.java 2 s .c o m*/ * #%L * Sigmah * %% * Copyright (C) 2010 - 2016 URD * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ import java.util.Collection; import java.util.Map; public class Main { /** * Returns if the given {@code collection} is {@code null} or empty. * * @param collection * The collection to test. * @return {@code true} if the given {@code collection} is {@code null} or {@code empty}. */ public static <C extends Collection<?>> boolean isEmpty(C collection) { return collection == null || collection.isEmpty(); } /** * Returns if the given {@code array} is {@code null} or empty. * * @param array * The array to test. * @return {@code true} if the given {@code array} is {@code null} or {@code empty}. */ public static <T extends Object> boolean isEmpty(T[] array) { return array == null || array.length == 0; } /** * Returns if the given {@code map} is {@code null} or empty. * * @param map * The map to test. * @return {@code true} if the given {@code map} is {@code null} or {@code empty}. */ public static <M extends Map<?, ?>> boolean isEmpty(M map) { return map == null || map.isEmpty(); } }