title: How to avoid adding duplicate values in shared preferences in android?
body: <p>In android, i am adding string values using shared preferences, but i want to compare the value which i am going to add to shared preferences with values which are already stored in shared preferences to avoid adding duplicate values, but i am not getting how to do this?
  or is there any alternate method to avoid adding duplicate values in shared preferences?</p>
  
  <p>I am adding string values using following code</p>
  
  <pre><code>  sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
    Editor editor = sharedpreferences.edit();
    editor.putString(Name, s);
    editor.commit(); 
  </code></pre>