Converting ArrayList of Characters to a String?

前端 未结 11 2133
清歌不尽
清歌不尽 2020-12-05 13:39

How to convert an ArrayList to a String in Java? The toString method returns it as [a,b,c] string - I wa

11条回答
  •  暖寄归人
    2020-12-05 13:55

    Many solutions available. You can iterate over the chars and append to a StringBuilder, then when finished appending, call .toString on the StringBuilder.

    Or use something like commons-lang StringUtils.join from the apache commons-lang project.

提交回复
热议问题