title: Comparator#comparing sort by the attribute of the class attribute
body: <p>Let say I have a class ClassA, and it has ClassB as its attribute:</p>
  
  <pre><code>public ClassA
  {
      private String attr;
      private ClassB classB;
  }
  
  public ClassB
  {
      private String attr1;
      private int attr2;
  }
  </code></pre>
  
  <p>From the class above, is it possible to sort the list of ClassA <code>List&lt;ClassA&gt; list</code> by attribute of ClassB using <code>Comparator</code>? It can be sort by the ClassA attribute easily by the code <code>Comparator.comparing(ClassA::getAttr)</code>, but what if I want to sort the list by the attribute in <code>ClassB</code>, let say the <code>attr2</code> attribute? </p>