重複の可能性:
java文字列の連結
ソースによると、これconcat
は次のように実装されています。
public String concat(String str) {
int otherLen = str.length();
if (otherLen == 0) {
return this;
}
int len = value.length;
char buf[] = Arrays.copyOf(value, len + otherLen);
str.getChars(buf, len);
return new String(buf, true);
}
+
文字列に関しては、実装は異なりますか?どのように?との間にパフォーマンスの違いは+
ありconcat
ますか?いつ他のものよりも選ばれるべきですか?