需求:給定一組對象集合,抽取這個List中每一個對象的單獨的屬性並且轉成String字符串
private String getNameLists(List<Student> studentList) {
Object[] objects = studentList.stream().map(Student::getName).toArray();
//StringUtil 引用自-import org.apache.commons.lang.StringUtils;
String busnessData = StringUtils.join(objects, ",");
return busnessData;
}