title: Sort list with empty and null values at the end
body: <pre><code>public class Test {
      private String name;
      private String position;
  
      // constructor, getters, setters
  
      public static void main(String[] args) {
          List&lt;Test&gt; footballTeam = new ArrayList&lt;&gt;();
          Test player1 = new Test(&quot;John&quot;, &quot;Forward&quot;);
          Test player2 = new Test(&quot;John&quot;, &quot;OT&quot;);
          Test player3 = new Test(&quot;Sam&quot;, &quot;Center &quot;);
          Test player4 = new Test(&quot;John&quot;, null);
          Test player5 = new Test(&quot;Adam&quot;, &quot;Opener&quot;);
          Test player6 = new Test(&quot;Nik&quot;, &quot;QB&quot;);
          Test player7 = new Test(&quot;John&quot;, &quot;&quot;);
  
          footballTeam.add(player1);
          footballTeam.add(player2);
          footballTeam.add(player3);
          footballTeam.add(player4);
          footballTeam.add(player5);
          footballTeam.add(player6);
          footballTeam.add(player7);
  
          footballTeam.sort(Comparator.comparing(Test::getName)
              .thenComparing(Comparator.comparing(Test::getPosition, 
                     Comparator.nullsLast(Comparator.naturalOrder()))));
  
          footballTeam.stream().forEach(System.out::println);
      }
  }
  </code></pre>
  <p>I have this data I am trying to sort this list by Name first and then by position.  This is the output I get</p>
  <pre><code>Adam Opener    
  John  
  John Forward  
  John OT  
  John null  
  Nik QB  
  Sam Center  
  </code></pre>
  <p>I want all the <code>null</code> and <code>&quot;&quot;</code> for a particular player to be at the end of the list. Note that the order of <code>null</code> vs <code>&quot;&quot;</code> is not that important.</p>
  <p>Expected Outcome</p>
  <pre><code>Adam Opener  
  John Forward  
  John OT  
  John   
  John null  
  Nik QB  
  Sam Center 
  </code></pre>