I have a list of items and in a for loop
i'm trying to compare this list but the list make ArrayOutOfBoundsException
.
Out of the for loop
the list has 4 items (0,1,2,3) but in the for have only 3 (0,1,2) when I try to access the last item an exception is raised.
List<Relatorio> relatorios = new RelatorioDao().listaTudoEmpresa(userWeb.logado);
for(int i = 0; i < relatorios.size(); i++){
if(!contem(relatorios.get(i))){
relatorios.remove(i);
}
}