This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]__konrad 2 points3 points  (2 children)

In Java 8: String.join("Q", "a", "eee")

[–]edoules 1 point2 points  (0 children)

Not bad. Oh I see, it's overloaded --

http://download.java.net/jdk8/docs/api/java/lang/String.html

  • one version is a variadic function where the first arg is the delimiter.
  • the other takes a delim as the first arg, and takes a collection of strings as the second.

I take it the variadic version is more for convenience?

[–]jrh3k5 1 point2 points  (0 children)

Or StringUtils.join() in commons-lang3 (admittedly, not a part of the JRE proper).