title: Java 8 sort on Class member's property
body: <p>Class declaration:</p>
  
  <pre><code>class Entity {
      String name;
      SubEntity subEntity; // subEntity has a method getAmount() which returns int
  }
  </code></pre>
  
  <p>I understand with Java 8 we can sort like:</p>
  
  <pre><code>entities.sort(Comparator.comparing(Entity::name));
  </code></pre>
  
  <p>But is there a way I can sort it on sub-entities' properties, for eg:</p>
  
  <pre><code>entities.sort(Comparator.comparing(Entity::SubEntity::getAmount()));
  </code></pre>
  
  <p>P.S: All in for any one-liners.</p>