How to convert an object in a list array to string?
Answers
Answered by
0
You have to loop through the list and fill your String[].
String[] array = new String[lst.size()];
int index = 0;
for (Object value : lst) {
array[index] = (String) value;
index++;
}
If the list would be of String values, List then this would be as simple as calling lst.toArray(new String[0]);
String[] array = new String[lst.size()];
int index = 0;
for (Object value : lst) {
array[index] = (String) value;
index++;
}
If the list would be of String values, List then this would be as simple as calling lst.toArray(new String[0]);
Similar questions