Skip to content

Instantly share code, notes, and snippets.

@SimonGivre
Created September 3, 2012 02:28
Show Gist options
  • Save SimonGivre/3606322 to your computer and use it in GitHub Desktop.
Save SimonGivre/3606322 to your computer and use it in GitHub Desktop.
Transform List of Bean into list of Bean's property values
import org.apache.commons.beanutils.BeanToPropertyValueTransformer;
import org.apache.commons.collections.CollectionUtils;
Collection<Long> userIds = (Collection<Long>) CollectionUtils.collect(users, new BeanToPropertyValueTransformer("id"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment