Why StringJoiner when we already have StringBuilder?

0 votes
asked Dec 15, 2016 by Hitesh Garg (799 points)  

I recently encountered with a Java 8 class StringJoiner which adds the String using the delimiters and adds prefix and suffix to it, but I can't understand the need of this class as it also uses StringBuilder at the backend and also performs a very simple operation of appending the Strings.

Am I missing something by not actually understanding the real purpose of this class?

Please log in or register to answer this question.