Sometimes when traversing the for loop to assemble the string, a separator is added at the end, which requires additional processing. Here is a little trick to avoid the last separator.
boolean needSeperate = false;
for (String tag : tagList) {
if (needSeperate) {
buf.append(",");
}
buf.append(tag);
needSeperate = true;
}