title: Sorting Alphabetically Type Of Hashmap Values In Android
body: <p>In my application i trying to sort Name by <strong>Alphabetically</strong> order in <strong>listView</strong> .Got successfully values from <strong>Local Database</strong> .May I know what is the correct way to achieve my objective? I did't find any suitable solution.Please Help me out.</p>
  
  <p>My code is below </p>
  
  <pre><code>// Declare this 
  ArrayList &lt; HashMap &lt; String, Object &gt;&gt; Results;
  ArrayList &lt; HashMap &lt; String, Object &gt;&gt; ValuesSpeciality;
  public CustomAdapterSpecialityActivity adapterCustom;
  
  
  //get speciality list from local db and show on listview
  public void SpecialitiesOnList() {
      HashMap &lt; String, Object &gt; temp;
      List &lt; TaxonomyObjects &gt; contacts = db.getAllTaxonomy();
  
      for (TaxonomyObjects cn: contacts) {
          temp = new HashMap &lt; String, Object &gt; ();
          temp.put("provider", "" + cn.getDisplayName());
          temp.put("tvTaxonomyCode", "" + cn.getTaxonomyCode());
          System.out.println(temp);
          ValuesSpeciality.add(temp);
      }
  
      //searchResults=originalValuesSpeciality initially
      Results = new ArrayList &lt; HashMap &lt; String, Object &gt;&gt; (ValuesSpeciality);
  
      adapterCustom = new CustomAdapterSpecialityActivity(this, R.layout.list_item_service, searchResults);
      lv.setAdapter(adapterCustom);
      adapterCustom.notifyDataSetChanged();
  
      for (int i = 0; i &lt; adapterCustom.getCount(); i++) {
          HashMap &lt; String, Object &gt; hm = (HashMap &lt; String, Object &gt; ) adapterCustom.getItem(i);
  
          hm.put("position", i);
  
      }
  }
  </code></pre>
  
  <p><strong>As a result my Logcat shows this</strong> </p>
  
  <pre><code>{Code=204D00000X, provider=Neuromusculoskeletal Medicine &amp; OMM}  
   {Code=204F00000X, provider=Transplant Surgery}
   {Code=204R00000X, provider=Electrodiagnostic Medicine}
   {Code=207K00000X, provider=Allergy &amp; Immunology}
   {Code=204E00000X, provider=Oral &amp; Maxillofacial Surgery}
  </code></pre>
  
  <p>I trying to show <strong>provider</strong> Name <code>Alphabetically</code> order.</p>