I load the same basic shared preferences each time my app starts.
Users have the option to add their own entries which works fine.
I want to make sure that the preferences file isn’t just adding loads of duplicates, I assume if it finds the EXACT entry it will skip the putString command?
I tested my starting the app over and over (i don’t use clear()) and when i getAll there aren’t duplicates, so is that a valid test?
Thanks
The preferences are implemented as a
map, so when you put a string into the preferences, it overwrites the old value with the new value, if the key already exists.So no, your preference file won’t have duplicates in it if you call putString on the same key over and over.