I have a map with huge amount of data being populated (around 300,000 records in approx)
and iterating it as below ,
for (Map.Entry&
I would make something like this. Prepare the data for the operation.
I suppose you are updating a table like user which should have a unique Id.
Map emailIds = new HashMap();
Map emails = new HashMap();
for (Map.Entry> entry : testMap.entrySet()) {
-- DONOT DO THIS// send email with map keys as email'id
-- DONOT DO THIS// email content is populated from the list
-- DONOT DO THIS// Perform a sql update to the column with the dyanamic value generated here with the email'id
emails.put(emailId, content);
emailIds.put(id, emailId);
}
bulkEmailSend(emails);
bulkEmailUpdate(emailIds);
bulkEmailSend
and bulkEmailUpdate
are the methods which should be written to make the appropriate calls.
So, use the bulk email send and bulk emailId update methods to update the values back to the database.