Improve toString performance.

This commit is contained in:
Christian P. MOMON 2014-06-08 16:37:30 +02:00
parent ca060e2c79
commit 23516c108a

View file

@ -709,14 +709,24 @@ public class StringList extends ArrayList<String> implements CharSequence
{ {
String result; String result;
StringBuffer buffer = new StringBuffer(length()); if (size() == 1)
for (String string : this)
{ {
buffer.append(string); //
} result = get(0);
result = buffer.toString(); }
else
{
//
StringBuffer buffer = new StringBuffer(length());
for (String string : this)
{
buffer.append(string);
}
result = buffer.toString();
}
// //
return (result); return (result);