Name

StringBuilder

Synopsis

This class defines the same methods as StringBuffer but does not declare those methods synchronized, which can result in better performance in the common case in which only a single thread is using the object. StringBuilder is a drop-in replacement for StringBuffer and should be used in preference to StringBuffer except where thread safety is required. See StringBuffer for an overview of the methods shared by these two classes.

java.lang.StringBuilder

Figure 10-60. java.lang.StringBuilder

public final class StringBuilder extends AbstractStringBuilder implements CharSequence, 
Serializable {
// Public Constructors
     public StringBuilder( );  
     public StringBuilder(int capacity);  
     public StringBuilder(String str);  
     public StringBuilder(CharSequence seq);  
// Public Instance Methods
     public StringBuilder append(long lng);  
     public StringBuilder append(float f);  
     public StringBuilder append(double d);  
     public StringBuilder append(int i);  
     public StringBuilder append(String str);  
     public StringBuilder append(StringBuffer sb);  
     public StringBuilder append(CharSequence s);  
     public StringBuilder append(Object obj);  
     public StringBuilder append(char c);  
     public StringBuilder append(boolean b);  
     public StringBuilder append(char[ ] str);  
     public StringBuilder append(CharSequence s, int start, int end);  
     public StringBuilder append(char[ ] str, int offset, int len);  
     public StringBuilder appendCodePoint(int codePoint ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.