-
Enhancement
-
Resolution: Fixed
-
P4
-
5.0
-
b48
-
sparc
-
solaris_2.5, solaris_8
Reported by Remi Forax <###@###.###>
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.
PS: 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 :)
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.
PS: 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-6914123 (str) Missing synchronization in java.lang.String#contentEquals(CharSequence)
-
- Closed
-
-
JDK-4984984 Alpha Feedback: Severals methods that works with StringBuffer have no StringBuil
-
- Closed
-