My comment is about using plus out side of loops. Obviously we should use
StringBuilder when using loops. But we shouldn't uses it unnecessary
outside of loops since it affects readability.
On Thu, Dec 17, 2015 at 11:23 AM, Rasika Perera wrote:
> Hi All,
>
> Please find
+1
On Thu, Dec 17, 2015 at 1:55 PM, Manuranga Perera wrote:
> My comment is about using plus out side of loops. Obviously we should use
> StringBuilder when using loops. But we shouldn't uses it unnecessary
> outside of loops since it affects readability.
>
> On Thu, Dec 17, 2015
Hi All,
Please find comments inline.
Yes, this has been the case for sometime where internally append is used.
> Try the same with a loop.
+1 have tried this. Even though compiler is optimized to put StringBuilder
on multiple "+" concats not too *smart* to use the same StringBuilder
instance
I have compiled following class using javac 1.6.0_38
class X{
public String m(String a, String b, String c){
return a + b + c;
}
}
and decoupled using javap
class X {
X();
Code:
0: aload_0
1: invokespecial #1 // Method
Yes, this has been the case for sometime where internally append is used.
Try the same with a loop.
On Tue, Dec 15, 2015 at 11:43 PM, Manuranga Perera wrote:
> I have compiled following class using javac 1.6.0_38
>
> class X{
> public String m(String a, String b, String c){
>