Come posso installare un elenco in Java [duplicato]
Dec 09 2020
Nel ciclo seguente come posso creare un nuovo List <> ()?
ListlistOfString =?
Risposte
2 Aplet123 Dec 09 2020 at 22:11
A differenza degli array, non puoi farlo array[i] = val. Dovresti usare ArrayList.set:
// this must be set
announcementDTO.set(j, new ArrayList<>());
// this can still be get
announcementDTO.get(j).setIdShop(shopBean.getId());
announcementDTO.get(j).setNombreComercio(comercioBean.getNombre());
announcementDTO.get(j).setRazonSocial(comercioBean.getRazonSocial());