ArrayList

1 resposta
mysqljava
Deyvid_Martins

Boa noite, estou com seguinte problema
C:\Users\Deyvid\Dropbox\Imobiliaria_BK_DropBox\src\View\Contrato_AluguelView.java:678: warning: [unchecked] unchecked call to add(E) as a member of the raw type ArrayList
locatarios.add(String.valueOf(id));
where E is a type-variable:
E extends Object declared in class ArrayList

onde no meu código tenho:

ArrayList locatarios = new ArrayList<>();

for (int i = 0; i < tblLocatarios_Contrato.getRowCount(); i++) {

int id = Integer.parseInt(tblLocatarios_Contrato.getModel().getValueAt(i, 0).toString());

locatarios.add(String.valueOf(id));

}

como resolver?

1 Resposta

wldomiciano

Este aviso aparece porque vc esqueceu de passar o type-argument para o ArrayList. Para corrigir, basta fazer assim:

ArrayList<String> locatarios = new ArrayList<>();
Criado 28 de setembro de 2019
Ultima resposta 28 de set. de 2019
Respostas 1
Participantes 2