In my String, I can have an arbitrary number of words which are comma separated. I wanted each word added into an ArrayList. E.g.:
String s = \"a,b,c,d,e,...
If you want to convert a string into a ArrayList try this:
public ArrayList convertStringToArraylist(String str) {
ArrayList charList = new ArrayList();
for(int i = 0; i
But i see a string array in your example, so if you wanted to convert a string array into ArrayList use this:
public static ArrayList convertStringArrayToArraylist(String[] strArr){
ArrayList stringList = new ArrayList();
for (String s : strArr) {
stringList.add(s);
}
return stringList;
}