Java EE 5 SDK

com.sun.appserv.management.util.misc
Class CollectionUtil

java.lang.Object
  extended by com.sun.appserv.management.util.misc.CollectionUtil

public final class CollectionUtil
extends Object

Various helper utilities for Collections.


Method Summary
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 String toString(Collection c)
           
static String toString(Collection c, String delim)
           
static String[] toStringArray(Collection c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toString

public static String toString(Collection c,
                              String delim)
Returns:
a String

toString

public static String toString(Collection 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.


toStringArray

public static String[] toStringArray(Collection c)
Returns:
String[]

toArray

public static <T> T[] toArray(Collection<? extends T> c,
                              Class<T> elementClass)
Parameters:
c - the Collection
elementClass - 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

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.