Android examples for java.util:Map
add All Keys from Map to Collection
//package com.book2s; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; import java.util.Map; public class Main { public static <T> void addAllKeys(Collection<T> c, Map<T, ?> map) { c.addAll(map.keySet());/* ww w . j ava 2s.c om*/ } 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; } }