Java: convert List to a String

前端 未结 22 2604
日久生厌
日久生厌 2020-11-22 01:03

JavaScript has Array.join()

js>[\"Bill\",\"Bob\",\"Steve\"].join(\" and \")
Bill and Bob and Steve

Does Java have anything

22条回答
  •  醉酒成梦
    2020-11-22 01:43

    No, there's no such convenience method in the standard Java API.

    Not surprisingly, Apache Commons provides such a thing in their StringUtils class in case you don't want to write it yourself.

提交回复
热议问题