Suggestion : continuous calls of StringBuilder.append
o0lwj0o opened this issue · comments
Hi,
I have found some continuous calls about StringBuilder.append(..)
in some files. For example, there are several continuous calls from line 61 to 76 in the file https://github.com/hprose/hprose-java/blob/master/example/MyApplication/app/src/main/java/org/hprose/myapplication/MainActivity.java
public void run() {
TextView text = (TextView)findViewById(R.id.textView);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < users.length; i++) {
sb.append("name: ");
sb.append(users[i].name);
sb.append("\r\n");
sb.append("sex: ");
sb.append(users[i].sex);
sb.append("\r\n");
sb.append("birthday: ");
sb.append(users[i].birthday);
sb.append("\r\n");
sb.append("age: ");
sb.append(users[i].age);
sb.append("\r\n");
sb.append("married: ");
sb.append(users[i].married);
sb.append("\r\n");
sb.append("\r\n");
}
text.setText(sb.toString());
}
If it was achieved like StringBuilder.append(..).append(..)append(..)
, it will promote its performance.