String buffers are safe for use by multiple threads.
The methods are synchronized where necessary
so that all the operations on any particular instance behave
as if they occur in some serial order that is consistent with the order of the method calls
made by each of the individual threads involved.
... 중략
As of release JDK 5,
this class has been supplemented with an equivalent class
designed for use by a single thread, StringBuilder.
The StringBuilder class should generally be used in preference to this one,
as it supports all of the same operations but it is faster,
as it performs no synchronization.
즉, 결론은
StringBuffer
- Tthread safe가 보장되도록 처리가 되었기 때문에여러 thread에 의해 공유되어야 하는 경우에 사용하고,
StringBuilder
- 여러 thread에 의해 method내의 local로 사용되는 것처럼 공유될 필요가 없는 상황에서
속도 향상을 위해 사용
'개발로그' 카테고리의 다른 글
도스창에서 ls 사용하기 (0) | 2012.12.27 |
---|---|
자주 사용하는 이클립스 단축키 (0) | 2011.02.01 |
윈도우즈 탐색기에서 해당 폴더 위치로 CMD창 띄워 주는 REG (0) | 2008.12.01 |
자동 빌드 (0) | 2008.05.08 |
WAS에서-동작하는-프로그램-원격-디버깅하기 (0) | 2008.03.31 |