Convert the contents of the Java list into comma separated strings

bjhxcc 2022-01-27 00:11:28 阅读数:231

convert contents java list comma

Often used in actual projects

Method 1

String symbol = Joiner.on(",").join(symbolList);

Method 2:

String symbol = StringUtils.join(symbolList.toArray(), ",");

To replace the following method

 StringBuffer sb = new StringBuffer();
for(Object _symbol : symbolList){

copyright:author[bjhxcc],Please bring the original link to reprint, thank you.