Given
String s = "a" + "b" + "c";
Is it possible to transform it to
StringBuilder s = new StringBuilder().append("a").append("b").append("c");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is an intention for this, called Replace ‘+’ with ‘StringBuilder.append()’.
At least, it’s offered to me – I’m using IDEA 12 EAP (Early Access Program).
You can get it here: IDEA 12 EAP
The intention is offered when the caret is on the concatenated sequence, not from the String variable declaration itself.
Of course, after the transformation IDEA will inform you that such an append() sequence is silly, and will offer to simplify to a regular concatenation without any downsides.