0
Good morning guys, I need to convert a ArrayList
for a String[]
.
I could not make it work. Just returns me a giant string. Follow my code
public List<Item> geral(){
buscaLatLong();
List<String> nomes = new ArrayList<String>();
String[] namesArr = nomes.toArray(new String[resuladoLista.size()]);
List<Item> item = new ArrayList<>();
String listagem[] = namesArr;
for (int i = 0; i<listagem.length; i++){
Item item = new Item();
item.setNome(listagem[i]);
item.setNum(String.valueOf(i+1));
itemList.add(item);
}
return itemList;
}
I did a test with a String
fixed in the format below worked perfectly
String listagem[] = {"Teste1",
"Teste2",
"Teste3",
"Teste4"};
The result list is as private static ArrayList resuladoLista
;
How can I convert mine resuladoLista
for a string identical to listagem[]
?
Welcome, ask the question how the
resuladoLista
.– André Lins