title: How to create a list with an attribute taken from objects of a list in kotlin
body: <p>Let's assume there is a class <code>Person</code> with attributes <code>name</code> and <code>age</code> and there is a list <code>persons</code> with n person objects. Is there a more efficient way of creating an age list from the list <code>persons</code> other than this:</p>
  <pre class="lang-kotlin prettyprint-override"><code>val age_list= ArrayList&lt;Int&gt;()
  for(person in persons){
      age_list.add(person.getAge())
  }
  </code></pre>