title: How to sort a list by a private field?
body: <p>My entity class looks like this:</p>
  
  <pre><code>public class Student {
  
     private int grade;
  
     // other fields and methods
   }
  </code></pre>
  
  <p>and I use it like that:</p>
  
  <pre><code>List&lt;Student&gt; students = ...;
  </code></pre>
  
  <p>How can I sort <code>students</code> by <code>grade</code>, taking into account that it is a private field?</p>