1 package com.flexiblewebsolutions.util; 2 3 import java.util.ArrayList; 4 import java.util.Iterator; 5 6 /*** 7 * Some utils for working with Lists. 8 * 9 * @author Donavon Buss 10 */ 11 public class ListUtils 12 { 13 /*** 14 * Convert an array list of Strings to a String array 15 * 16 * @param pList List of Strings 17 * @return String array 18 */ 19 public static String[] convertToStringArray( ArrayList pList ) 20 { 21 String[] returnObject = null; 22 if( pList != null ) 23 { 24 returnObject = new String[pList.size()]; 25 int counter = 0; 26 for( Iterator it = pList.iterator(); it.hasNext(); ) 27 { 28 returnObject[counter] = (String) it.next(); 29 counter++; 30 } 31 } 32 return ( returnObject ); 33 } 34 }