I have two variables of type List
that need to be compared against each other to check for possible duplicates.
Example of Variable Content
Variable 01: [01, Test, Active]
Variable 02: [01, Test, Active]
I'm currently using the following script
in Groovy to check:
for (TransportadoraPostgreSQL transportadorasBDM : transportadorasBanco){
for(List transportadoraAVerificar : listaTransportadora){
if (transportadorasBDM.getCodigo().toString().equals(transportadoraAVerificar.get(0).toString())){
//logger.info("Iguais")
}
}
}
But in this way when the two variables have, for example, 100 records each, there will be 10,000 checks in Loop , is there any way to be more efficient this check?