其他分享
首页 > 其他分享> > 拼接List的属性成str

拼接List的属性成str

作者:互联网

// 法一
String fieldStr = list.stream().map(n -> n.getDimension1()).collect(Collectors.joining(","));
// 法二
List<String> fieldList = Lists.newArrayList();
for (ChartDataView chartDataView : list) {
    fieldList.add(chartDataView.getDimension1());
}
String fieldStr = StringUtils.join(fieldList, ",");

标签:String,chartDataView,List,getDimension1,fieldStr,拼接,fieldList,str
来源: https://www.cnblogs.com/jqccan/p/16433309.html