According to the following code, I have to set the value of objects from one list by getting the values from other objects. For the reason of reducing process, I'm deleting each object from the second list after setting value. Doing so, the second list will reduce for each loop as well as the CPU process. Is my thought right? Will I get to reduce some process doing so?
for(Product product : _session.getProducts()){
for(Product newProduct : _newSession.getProducts()){
if(product.getID() == newProduct.getID()){
product.setValue(newProduct.getValue());
_newSession.getProducts().remove(newProduct);
break;
}
}
}