Is there a cleaner way to loop and capture the object ids to a list?
<p>Say I have a collection of users:</p>

<pre><code>List&lt;User&gt; users = ...;
</code></pre>

<p>Now I want to get all the id's for the users in a list, currently I am doing:</p>

<pre><code>for(User user : users) {
  userIds.add(user.getId());
}
</code></pre>

<p>Is there a more elegant way of doing this?</p>

<p>I know java doesnt' support linq, so maybe this is the only way but just thought I'd ask.</p>
