Vc não pode fazer cast entre coisas que são “diferentes”. String[] é um array ArrayList é uma lista.
Vc pode criar um List a partir de um array.
List<String> lista = Arrays.asList( seuArrayDeStringsAqui );
[]´s
M
marcianorott
Foi mals…
Valeu pela orientação galera…
Vou ver se consigo fazer com as dicas de vocês…
Grande abraço,…
peczenyj
Lembrando que a especificação diz:
Returns a fixed-size list backed by the specified array. (Changes to the returned list “write through” to the array.) This method acts as bridge between array-based and collection-based APIs, in combination with Collection.toArray. The returned list is serializable and implements RandomAccess.
This method also provides a convenient way to create a fixed-size list initialized to contain several elements:
List stooges = Arrays.asList("Larry", "Moe", "Curly");
The type List is not generic; it cannot be parameterized with arguments
E
entanglement
Acho que você importou java.awt.List, mas o correto é importar java.util.List. OK?
M
marcianorott
Importei o java.util.List.
M
marcianorott
Não tem jeito… :oops: :oops:
List<String>lista2=Arrays.asList(parametros.get("selecionadosReqTi[]")[0]);for(inti=0;i<lista2.size();i++){//Seto 09 itens no form.//Porém ele só itera uma vez nesse FOR//Minha lógica esta errada?//Não consigo adicionar os itens para dentro da lista2..System.out.println("Aqui");}
//Caso consiga// depois para setar o atributo do objeto do tipo:ArrayList<String>competenciasTi;//Faria um cast de list to array?curriculo.setCompetenciasTi((ArrayList<String>)lista2);