개발/Java

StringJoiner

728x90

문자열을 예쁘게 처리하기 위한 java.util 에 포함되어 있고, 순차적으로 나열되는 문자열을 처리할 때  사용됨.

 

 

 

 * {@code StringJoiner} is used to construct a sequence of characters separated
 * by a delimiter and optionally starting with a supplied prefix
 * and ending with a supplied suffix.
 * <p>
 * Prior to adding something to the {@code StringJoiner}, its
 * {@code sj.toString()} method will, by default, return {@code prefix + suffix}.
 * However, if the {@code setEmptyValue} method is called, the {@code emptyValue}
 * supplied will be returned instead. This can be used, for example, when
 * creating a string using set notation to indicate an empty set, i.e.
 * <code>"{}"</code>, where the {@code prefix} is <code>"{"</code>, the
 * {@code suffix} is <code>"}"</code> and nothing has been added to the
 * {@code StringJoiner}.

 

'개발 > Java' 카테고리의 다른 글

Parallel array sorting 병렬 배열 정렬  (0) 2021.05.18
StringBuilder, StringBuffer  (0) 2021.05.18
자바 Optional 이란  (0) 2021.05.18
NIO2  (0) 2021.05.18
ThreadLocal이란?  (0) 2021.05.17