Why StringJoiner when we already have StringBuilder?

0 votes
124 views
asked Dec 16, 2016 by Hitesh Garg (127 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.

Welcome to Codingeek Q&A, where you can ask questions and receive answers from other members of the community.
...