Package org.glassfish.admin.amx.util
Class CollectionUtil
- java.lang.Object
-
- org.glassfish.admin.amx.util.CollectionUtil
-
public final class CollectionUtil extends Object
Various helper utilities for Collections.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> void
addAll(Collection<T> c, T[] items)
static <T> void
addArray(Collection<T> c, T[] array)
Add all items in an array to a set.static <T> T
getSingleton(Collection<T> s)
static boolean
isAllStrings(Collection<?> c)
static <T> T[]
toArray(Collection<? extends T> c, Class<T> elementClass)
static <T> String
toString(Collection<T> c, String delim)
static <T> String[]
toStringArray(Collection<T> c)
static <T> List<String>
toStringList(Collection<T> c)
-
-
-
Method Detail
-
addAll
public static <T> void addAll(Collection<T> c, T[] items)
-
toString
public static <T> String toString(Collection<T> c, String delim)
- Returns:
- a String
-
toStringArray
public static <T> String[] toStringArray(Collection<T> c)
- Returns:
- String[]
-
toStringList
public static <T> List<String> toStringList(Collection<T> c)
-
getSingleton
public static <T> T getSingleton(Collection<T> s)
-
addArray
public static <T> void addArray(Collection<T> c, T[] array)
Add all items in an array to a set.
-
toArray
public static <T> T[] toArray(Collection<? extends T> c, Class<T> elementClass)
- Parameters:
c
- the CollectionelementClass
- the type of the element, must be non-primitive- Returns:
- array of
[] elements
-
isAllStrings
public static boolean isAllStrings(Collection<?> c)
- Returns:
- true if all elements are String, and there is at least one element
-
-