title: What is the difference between using comparable by passing instance of our model class to comparable and passing wrapper to comparable?
body: <p>Suppose I have a Student class with attributes name and id. And I want to sort the <code>List</code> of students in natural order of their respective ids using <code>Collections.sort()</code> method. I can do it in following two ways:</p>
  
  <pre><code> public class Student implements Comparable&lt;Student&gt; {
  
       private Long id;
       private String name;
  
       // getters and setters..
  
       public int compareTo(Student student){
           return this.getId().compareTo(student.getId());
       }
   }
  </code></pre>
  
  <p>And the other way is:</p>
  
  <pre><code>public class Student implements Comparable&lt;Long&gt; {
  
      private Long id;
      private String name;
  
      // getters and setters..
  
      public int compareTo(Long id){
          return this.getId().compareTo(id);
      }
  }
  </code></pre>
  
  <p>And then use the <code>Collections.sort()</code> method to sort the list of students. My question or confusion is what difference does it make if we use one over other as they both produce the same result.</p>