Java tutorial
//package com.java2s; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import java.util.Collection; public class Main { /** * Converts a collection of objects into a collection of strings by calling toString on each object. * @param items the objects to convert * @return A collection of strings */ public static Collection<String> convertToStrings(Iterable<?> items) { Iterable<String> codes = Iterables.transform(items, new Function<Object, String>() { public String apply(Object item) { return item.toString(); } }); return Lists.newArrayList(codes); } }