title: How can I use Java 8 streams to sort an ArrayList of objects by a primitive int member?
body: <p>Here is an example class.  I know the simplest thing would be to change the members from primitive type <code>int</code> to object <code>Integer</code> and use stream/lambda/sorted, but there may be reasons to only have a primitive type <code>int</code> such as space.
  How could I use the streams API to sort a <code>List&lt;DateRange&gt;</code> by <code>int</code> member <code>startRange</code>?</p>
  
  <pre><code>List&lt;DateRange&gt; listToBeSorted = new ArrayList&lt;DateRange&gt;();
  
  
  static private class DateRange
  {
      private int startRange ;
      private int endRange ;
      public int getStartRange() {
          return startRange;
      }
      public void setStartRange(int startRange) {
          this.startRange = startRange;
      }
      public int getEndRange() {
          return endRange;
      }
      public void setEndRange(int endRange) {
          this.endRange = endRange;
      }
  }
  </code></pre>