1
I have two main Arrays (listaInformacoesNota
,listaInformacoesPedidosPostgreSQL
) with N
subArrays each, these subArrays have items in common and a different item only, I did the following to compare these each subArray:
for (List conteudoNotas : listaInformacoesNota){
for (List conteudoPedidos : listaInformacoesPedidoPostgreSQL){
if (conteudoNotas.get(3).toString().equals(conteudoPedidos.get(2).toString()) && conteudoNotas.get(4).toString().equals(conteudoPedidos.get(4).toString())){
if (conteudoNotas.get(1).toString().equals(conteudoPedidos.get(1).toString()) && conteudoNotas.get(2).toString().equals(conteudoPedidos.get(3).toString())){
\\Aqui eu precisaria remover o subArray (conteudoNotas) do Array principal (listaInformacoesNota)
}
}
}
}
My need is to remove from the Main Array listaInformacoesNota
the subArray condicoesNotas
that fit the conditions, so that it is not compared again with any other subArray.
What is the content of the 2 arrays? Why access to specified arrays positions within ifs (
conteudoNotas.get(3)...
) ?– Isac
What exactly is your question? To remove an item from a list just do
lista.remove(item)
, but you cannot do this while iterating the list in question. To do this you need to use the interfaceIterator
. You can have the required iterator throughlistaInformacoesNota.iterator();
. Through theIterator
you will be able to iterate the list (actually iterate theIterator
) and remove the desired item.– igventurelli