I need to check if an object present in list A exists in list B without using nested for loops because if the lists have a large size, it takes too much time.
This is my code :
for(Person el : persons)
{
for(Client in : clients)
{
if(el.getIdentifier() == in.getTire().getIdentifier())
{
exists=true;
break;
}
}
}
How can i achieve the same result without using loops and break?