I have this code where the ArrayList was instantiated outside any condition:
List<PatientDto> list = new ArrayList<PatientDto>();
for(Object o : ObjectList){
if(true){
PatientDto patient = new PatientDto(....);
list.add(patient);
}
}
PatientDto dto = list.get(0);
Will I still be able to retrieve the new PatientDto() as I access the list, given that it was instantiated within the if statements?
Aucun commentaire:
Enregistrer un commentaire