Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static <T> boolean isEmpty(Collection<? extends T> collection) { return size(collection) == 0; } public static <T> boolean isEmpty(T[] array) { return array == null || array.length == 0; } public static int size(Collection<?> collection) { return collection != null ? collection.size() : 0; } public static <T> int size(T[] array) { return array == null ? 0 : array.length; } }