title: Better way to convert an List<MyDataType> to List<String>
body: <p>I am wondering if there isn't a better way to convert whole <code>Lists</code> or <code>Collections</code> as the way I show in the following code example:</p>
  
  <pre><code>public static List&lt;String&gt; getAllNames(List&lt;Account&gt; allAccounts) {
          List&lt;String&gt; names = new ArrayList&lt;String&gt;(allAccounts.size());
          for (Account account : allAccounts) {
              names.add(account.getName());
          }
          return names;
      }
  </code></pre>
  
  <p>Every time I produce a <code>method</code> like this, I start thinking, isn't there a better way? My first thought would be to create maybe a solution with some <code>generics</code> and <code>reflections</code>, but this seems maybe a bit over sized and maybe a bit to slow when it comes to performance?</p>