I am storing Identification addresses in my ArrayList. The problem is I am storing it repeatedly.
Here is the relevant code:
public void storeIDs(final String emailAddress) {
SharedPreferences.Editor editor = context.getSharedPreferences("storeIds", MODE_PRIVATE).edit();
IDAddresses.add(emailAddress);
for(int i=0;i<IDAddresses.size();i++)
{
editor.putString("value"+i,IDAddresses.get(i));
}
editor.putInt("emailListSize",IDAddresses.size());
editor.apply();
}
How do I check if the emailAddress
already exists in the ArrayList IDAddresses
and if it exists, then dont store it?