title: Remove duplicate values from spinner
body: <p>I am trying to load spinner from json data using following code:</p>
  
  <pre><code> @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      ArrayList&lt;String&gt; items = getCountries("data.json");
  
      Spinner spinner = (Spinner)findViewById(R.id.spinnerStandard);
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.second_layout,R.id.txtStandard,items);
      spinner.setAdapter(adapter);
  }
  
  private ArrayList&lt;String&gt; getCountries(String fileName){
      JSONArray jsonArray = null;
      ArrayList&lt;String&gt; cList = new ArrayList&lt;String&gt;();
      try {
          InputStream is = getResources().getAssets().open(fileName);
          int size = is.available();
          byte[] data = new byte[size];
          is.read(data);
          is.close();
          String json = new String(data, "UTF-8");
          jsonArray=new JSONArray(json);
          if (jsonArray != null) {
              for (int i = 0; i &lt; jsonArray.length(); i++) {
                  cList.add(jsonArray.getJSONObject(i).getString("standard"));
              }
          }
      }
      catch (IOException e)
      {
          e.printStackTrace();
      }
      catch (JSONException je)
      {
          je.printStackTrace();
      }
      return cList;
  }
  </code></pre>
  
  <p>My json data is,</p>
  
  <pre><code>[
  {
      "name":"Manoj",
      "surname":"Jadhav",
      "age":"18",
      "div":"A",
      "standard":"7"
  },
  {
      "name":"Nilesh",
      "surname":"Patankar",
      "age":"17",
      "div":"B",
      "standard":"7"
  },
  {
      "name":"Gourav",
      "surname":"Patil",
      "age":"18",
      "div":"A",
      "standard":"8"
  },
  {
      "name":"Pushkar",
      "surname":"Ganpule",
      "age":"17",
      "div":"A",
      "standard":"7"
  },
  {
      "name":"Prashant",
      "surname":"Raut",
      "age":"18",
      "div":"A",
      "standard":"8"
  },
  {
      "name":"Nachiket",
      "surname":"Salvi",
      "age":"17",
      "div":"A",
      "standard":"7"
  },
  {
      "name":"Hiren",
      "surname":"Lakhmani",
      "age":"18",
      "div":"B",
      "standard":"6"
  }
  </code></pre>
  
  <p>]</p>
  
  <p>In json data I am having duplicate standard values as I want to load only unique values from json into spinner (like there are standard values are 7, 7, 8, 7, 8, 7, 6 and I want to show only 6, 7, 8 out of those duplicate values.)</p>
  
  <p>I've tried googling for all the options and as many other variations as I can think of and can't find any useful results, so I'm obviously missing something.</p>
  
  <p>What is correct way to remove duplicate values ?</p>