Java tutorial
//package com.java2s; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; public class Main { public static <T> String getCommaSeparatedNames(List<T> list, Function<T, String> function) { return list.stream().map(function).collect(Collectors.joining(",")); } }