Remove item from a list of objects

-1

I have a list of objects and I have to remove an element from it.

 vlstZonas = zonaContr.getDatosZona(IdParticipante);

The method returns a list of objects like the one in the image.

I've tried things like this:

 int zona = (Integer)vlstZonas.get(0).get(idZona);
 int zona = (Integer)vlstZonas.get(0).get(0);
 int Zona = (int) vlstZonas.getIdZona();
    
asked by urrutias 12.04.2017 в 12:32
source

2 answers

2

Do a forEach, this will get all the objects from the array

int idZona;
        for (ZonaMayoristaPOJO objetoSacado : vlstZonas) {
            idZona = objetoSacado.getIdZona();
        }

I understand that ZonaMayoristaPOJO is the object that contains those attributes Then you would get the data you want from the object through getters

    
answered by 12.04.2017 / 12:37
source
1

I think you're misreading it. You are casting to Integer an object of type ZonaMayoristaPOJO. That is, you want to access idZona that is an integer, it would be something like this:

int zona = ((ZonaMayoristaPOJO)vlstZonas[0]).getIdZona();
    
answered by 12.04.2017 в 12:47