title: Converting a custom object list in simple list in kotlin
body: <p>I have a list of custom objects. Below is the <code>data class</code>:</p>
  
  <pre><code>data class ProductsResponse(
          val id:String,
          val ProductType:String
  )
  </code></pre>
  
  <p>I have a below list:</p>
  
  <p><code>var productList: List&lt;ProductResponse&gt;</code></p>
  
  <p>I want the output as:</p>
  
  <p><code>var productNameList: List&lt;String&gt;</code></p>
  
  <p>I want to get a list which consist of only <code>ProductType</code> i.e a <code>list</code> of <code>Strings</code></p>
  
  <p>I know using a for loop and copying the <code>ProductType</code> string to a new list will do the job. But I wanted to do it in a more shorter way using the power <code>Kotlin</code> provides.</p>
  
  <p>How can I convert the above custom object <code>list</code> to a <code>list</code> of <code>Strings</code> in <strong>Kotlin way</strong>?</p>