title: How to transform List<X> to another List<Y>
body: <p>I have two lists of objects; <code>List&lt;X&gt;</code> and <code>List&lt;Y&gt;</code>. <code>X</code> and <code>Y</code> are ojects that look like:</p>
  
  <pre><code>public class X {
      String a;
      String b;
      String v;
      String w;
      String m;
      String n;
  }
  
  public class Y {
      String a;
      String b;
      List&lt;A&gt; aList;
  }
  public class A {
      String v;
      String w;
      List&lt;B&gt; bList;
  }
  public class B {
      String m;
      String n;
  }
  </code></pre>
  
  <p>How transform <code>List&lt;X&gt;</code> into <code>List&lt;Y&gt;</code> based on a rule:<br>
  Some fields' values must be equal.<br>
  For example:<br>
  In <code>List&lt;Y&gt;</code>, for one object Y, field a's value must equal.<br>
  In Y's field <code>List&lt;A&gt;</code>, for one object A, field w's value must equal.<br/>
  In A's field <code>List&lt;B&gt;</code>, for one object B, field m's value must equal and so on.<br/> </p>
  
  <p>Guava has this method, <a href="https://google.github.io/guava/releases/19.0/api/docs/com/google/common/collect/Lists.html#transform(java.util.List,%20com.google.common.base.Function)" rel="noreferrer">Lists#transform</a>, but I don't know how to transform.</p>
  
  <p>Or any other way?</p>