Hazem-Ben-Khalfallah
7/2/2013 - 10:52 AM

transform a list of objects into another

transform a list of objects into another

import com.google.common.collect.Lists;

final List<String> newList = Lists.transform(tweets, transfom);


/**
 * transform a List
 */
final public static Function<Tweet, String> transfom = new Function<Tweet, String>() {
    @Nullable
    @Override
    public String apply(@Nullable Tweet tweet) {
        return tweet.twitterUserId;
    }
};