title: How to sort values from value <String, Long> in an arraylist?
body: <p>Is it possible to sort the current output of the code below in descending order without using comparators?</p>
  
  <p>I've tried using one but I can't seem to make it work as it always gives an error.</p>
  
  <p>I've tried looking at these two links as I know the answers might be in there:
  <a href="https://stackoverflow.com/questions/30083161/sort-mapstring-long-by-value-reversed">Sort Map&lt;String, Long&gt; by value reversed</a> , <a href="https://stackoverflow.com/questions/109383/sort-a-mapkey-value-by-values">Sort a Map&lt;Key, Value&gt; by values</a><br>
  But since I'm quite new to java I don't really get what I need to do in order to get it working.</p>
  
  <pre class="lang-java prettyprint-override"><code>myRef.addChildEventListener(new ChildEventListener() {
      @Override
      public void onChildAdded(@NonNull DataSnapshot dataSnapshot , String s) {
          Map&lt;String, Object&gt; userInfo = (Map&lt;String, Object&gt;)dataSnapshot.getValue();
          String username = (String) userInfo.get("username");
  
          Map&lt;String, Long&gt; steps = (Map&lt;String, Long&gt;) userInfo.get("steps");
  
          long existingSteps = 0;
          for (Map.Entry&lt;String, Long&gt; step : steps.entrySet()) {
              existingSteps += Long.valueOf(step.getValue());
          }
  
          arrayList.add(new String( username + "  -  " + "steps:  " + existingSteps));
  
          arrayAdapter = new ArrayAdapter&lt;&gt;(Leaderboard.this , 
          android.R.layout.simple_list_item_1 , arrayList);
  
          listView.setAdapter(arrayAdapter);
  }
  </code></pre>
  
  <p>The current output of this code is:  </p>
  
  <pre><code>John Doe I - Steps: 79
  John Doe II - Steps: 111
  John Doe III - Steps: 0
  John Doe IV - Steps: 88
  John Doe V - Steps: 12
  John Doe VI - Steps: 0
  </code></pre>
  
  <p>preferred this code to run the following output:  </p>
  
  <pre><code>John Doe II - Steps: 111
  John Doe IV - Steps: 88
  John Doe I - Steps: 79
  John Doe V - Steps: 12
  John Doe III - Steps: 0
  John Doe VI - Steps: 0
  </code></pre>
  
  <p>Is it possible for someone to explain to me how I would need to use those said links to get it working for me so I could get the output as listed above ?</p>