title: How to map nested collections using MapStruct?
body: <p>I have 2 entities:</p>
  
  <p><strong>Entity 1:</strong></p>
  
  <pre><code>public class Master {
  
      private int id;
      private Set&lt;SubMaster&gt; subMasters= new HashSet&lt;SubMaster&gt;(0);
  }
  
  public class SubMaster{
      private int subId;
      private String subName;
  }
  </code></pre>
  
  <p><strong>Entity 2:</strong></p>
  
  <pre><code>public class MasterDTO {
  
      private int id;
      private Set&lt;SubMaster&gt; subMasters= new HashSet&lt;SubMaster&gt;(0);
  }
  
  public class SubMasterDTO{
      private int subId;
      private String subName;
  }
  </code></pre>
  
  <p>I am using MapStruct Mapper to map values of POJO to another.</p>
  
  <pre><code>public interface MasterMapper{
      MasterDTO toDto(Master entity);
  }
  </code></pre>
  
  <p>I am able to successfully map <code>Master</code> to <code>MasterDTO</code>. But, the nested collection of <code>SubMaster</code> in <code>Master</code> is not getting mapped to its counterpart in <code>MasterDTO</code>.</p>
  
  <p>Could anyone help me in right direction?</p>