Java tutorial
//package com.java2s; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; import java.util.Map; public class Main { public static <T> void addAllValues(Collection<T> c, Map<?, T> map) { c.addAll(map.values()); } public static <T> void addAll(Collection<T> c, T[] array) { if (isEmpty(array)) { return; } c.addAll(Arrays.asList(array)); } public static <T> void addAll(Collection<T> c, Enumeration<T> enumeration) { while (enumeration.hasMoreElements()) { c.add(enumeration.nextElement()); } } public static boolean isEmpty(Collection<?> c) { return c == null || c.isEmpty(); } public static boolean isEmpty(Map<?, ?> map) { return map == null || map.isEmpty(); } @SafeVarargs public static <T> boolean isEmpty(T... array) { return array == null || array.length == 0; } }