title: How to initialize Array<List<Model>> in Kotlin?
body: <p>I have a JSON string which coming from rest API and I'm binding that into <code>List&lt;CategoryDO&gt;</code> object. I have all category/sub-category data into this list object <code>List&lt;CategoryDO&gt;</code> but I don't know how to separate sub-categories from those data into <code>Array&lt;List&lt;CategoryDO&gt;&gt;</code> format. </p>
  
  <p>How can I add sub-category list into <code>Array&lt;List&lt;CategoryDO&gt;&gt;</code> object? How can I declare and initialize <code>Array&lt;List&lt;CategoryDO&gt;&gt;</code> in Kotlin? </p>
  
  <p>All categories should be in <code>List&lt;CategoryDO&gt;</code> format and all sub-categories in <code>Array&lt;List&lt;CategoryDO&gt;&gt;</code> format.</p>
  
  <p>For Example:</p>
  
  <pre><code>List&lt;CategoryDO of Cat-1, CategoryDO of cat-2, ... etc&gt;
  
  Array&lt;List&lt;CategoryDO of SubCat-1 of Cat-1, CategoryDO of SubCat-2 of Cat-1&gt;&gt;, List&lt;CategoryDO of SubCat-12 of Cat-2, CategoryDO of SubCat-22 of Cat-2&gt;&gt;, ...etc&gt;&gt;
  </code></pre>
  
  <p>CategoryDO data class:</p>
  
  <pre><code>data class CategoryDO(  @SerializedName("Id")
                      @Expose
                      var id: Long? = null,
                      @SerializedName("Name")
                      @Expose
                      var name: String? = null,
                      @SerializedName("SubCategories")
                      @Expose
                      var subCategories: List&lt;CategoryDO&gt;? = null)
  </code></pre>
  
  <p>Actually, I need to pass this separate Category/Sub-Category things to <code>CategoryAdapter</code> class.</p>
  
  <p><code>CategoryAdapter</code> class sample:</p>
  
  <pre><code>class CategoryAdapter : BaseExpandableListAdapter {
  private var groupItem: List&lt;CategoryDO&gt;
  private var contentItem: Array&lt;List&lt;CategoryDO&gt;&gt;
  private var context: Context
  private var imageOnClickListener: View.OnClickListener
  
  constructor(context: Context, groupItem: List&lt;CategoryDO&gt;, contentItem: Array&lt;List&lt;CategoryDO&gt;&gt;, imageOnClickListener: View.OnClickListener) {
          this.groupItem = groupItem
          this.contentItem = contentItem
          this.context = context
          this.imageOnClickListener = imageOnClickListener
      }
    .
    .
    .
  }
  </code></pre>