Severals methods that works with StringBuffer have no
StringBuilder equivalent.
1) There is no contentEquals(StringBuilder) in class String.
2) In StringBuilder and StringBuffer, there is a
method append(StringBuffer sb) but no
append(StringBuilder).
In case 2, the the code :
StringBuilder b=new StringBuilder.append(new StringBuilder());
I think the method append(CharSequence) must be called instead.
It works but i think that a method append(StringBuilder) could
perform better using getChar(...) instead of
a loop over each character.
The append(StringBuilder) could be inserted to
AbstractStringBuilder.
Moreover, the class par of the String documentation have
lot of links to StringBuffer. I think, all this links
could be transfered to StringBuilder.
lot of methods in AbstractStringBuilder return an
AbstractStringBuilder that is not used in overriden
counterparts in StringBuffer and StringBuilder.
Perhaps, this methods could return void to avoid
a supplementary pop opcode (poor man optimisation :)
StringBuilder equivalent.
1) There is no contentEquals(StringBuilder) in class String.
2) In StringBuilder and StringBuffer, there is a
method append(StringBuffer sb) but no
append(StringBuilder).
In case 2, the the code :
StringBuilder b=new StringBuilder.append(new StringBuilder());
I think the method append(CharSequence) must be called instead.
It works but i think that a method append(StringBuilder) could
perform better using getChar(...) instead of
a loop over each character.
The append(StringBuilder) could be inserted to
AbstractStringBuilder.
Moreover, the class par of the String documentation have
lot of links to StringBuffer. I think, all this links
could be transfered to StringBuilder.
lot of methods in AbstractStringBuilder return an
AbstractStringBuilder that is not used in overriden
counterparts in StringBuffer and StringBuilder.
Perhaps, this methods could return void to avoid
a supplementary pop opcode (poor man optimisation :)
- relates to
-
JDK-4982981 Methods that work with StringBuffer have no StringBuilder equivalent
-
- Resolved
-