Pages

Monday, December 28, 2009

Method to assimilate the contents of a string Array List into a string array

<i>/**
* Method to assimilate the contents of a string Array List into a string array
* @param arrList - an array list with string objects
* @return String[]
* @author karthikeyan_a
* @since 30-April-2009
*/</i>
public String[] arrayListToStringArray(ArrayList arrList){
String[] strArray=null;
Object[] elements=arrList.toArray();
strArray=new String[elements.length];
int countItr=0;
for (countItr=0;countItr<elements.length;countItr++){
strArray[countItr]=elements[countItr].toString();
}
//recycle objects
elements=null;
arrList=null;

return strArray;
}

No comments:

Post a Comment