In this article, we will see how to use StringJoiner class to append string s to each with adding a open and close tags to beginning and end of appended string in Java.
Lets look to our code.
StringJoiner sj1 = new StringJoiner(",","{","}");
sj1.add("andromeda").add("vega");
Lets see it in an example.
In above example, we append two StringJoiner object using "," delimiter, we merged two string and added "{" to beginning, "}" to end of appended string in Java.