Name: krT82822 Date: 09/24/99
orig synopsis: "Lack of an add method for StringBuffer class with StringBuffer as a parameter"
StringBuffer doesn't have an "add" method with StringBuffer as
a parameter. This method could help to "concatenate" one
StringBuffer to another without converting to String or
playing with "char" arrays.
The following is the proposed implementation for this method:
public synchronized StringBuffer append(StringBuffer strbuf)
{
int len = strbuf.length();
int newcount = count + len;
if (newcount > value.length)
expandCapacity(newcount);
System.arraycopy(strbuf.getValue(), 0, value, count, len);
count = newcount;
return this;
}
(Review ID: 95673)
======================================================================
- duplicates
-
JDK-4144267 StringBuffer needs another append method
-
- Closed
-