luomuqinghan / weibo4j

Automatically exported from code.google.com/p/weibo4j
Other
0 stars 1 forks source link

toString方法里面的字符串拼接太多了,这样很创建了太多的String对象啊 #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
public String toString() {
        return "Emotion [phrase=" + phrase + ", type=" + type + ", url=" + url
                + ", hot=" + hot + ", common=" + common + ", value=" + value
                + ", category=" + category + ", picid=" + picid + ", icon="
                + icon + "]";
    }

为什么不用StringBuffer或者StringBuider来构建好然后再返回,这��
�直接将String字符串相加,创建太多的String对象了,非常占内�
��啊。。。

Original issue reported on code.google.com by wangpeih...@gmail.com on 10 Feb 2012 at 1:56

GoogleCodeExporter commented 8 years ago
jdk5以上编译器会自动优化

Original comment by jilen.zh...@gmail.com on 13 Apr 2012 at 3:46