FileDocCategorySizeDatePackage
ContainerHelper.javaAPI DocGlassfish v2 API3681Fri May 04 22:34:58 BST 2007com.sun.enterprise.tools.common.util

ContainerHelper

public class ContainerHelper extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		ArrayList L1 = new ArrayList();
		ArrayList L2 = new ArrayList();

		L1.add("Hello");//NOI18N
		L1.add("World");//NOI18N
		L1.add("!!!");//NOI18N
		L2.add(new Integer(5));
		L2.add(new Integer(7));

		String ss[] = toStringArray(L1);

		for(int i = 0; i < ss.length; i++)
			System.out.println("String #" + i + ":  " + ss[i]);//NOI18N
		
		// should throw 
		try
		{
			ss = toStringArray(L2);
		}
		catch(ArrayStoreException e)
		{
			System.out.println("Caught an Exception, as expected:  " + e);//NOI18N
		}
	
public static java.util.ArrayListtoArrayList(java.lang.String[] ss)

		if(ss == null)
			return new ArrayList();

		ArrayList list = new ArrayList(ss.length);

		for(int i = 0; i < ss.length; i++)
			list.add(ss[i]);

		return list;
	
public static java.lang.StringtoOneString(java.lang.String[] ss)

		String s = new String();
		
		for(int i = 0; ss != null && i < ss.length; i++)
		{
			s += ss[i] + "\n";//NOI18N
		}
		return s;
	
public static java.lang.String[]toStringArray(java.util.AbstractCollection coll)

		String ss[] = new String[0];

		if(coll.size() > 0)
			ss = (String[]) coll.toArray(ss);

		return ss;