add a couple of StringBuffer.append overloads

This commit is contained in:
Joel Dice 2009-08-20 08:59:22 -06:00
parent 6196f61938
commit 71f1efc4cb
2 changed files with 14 additions and 1 deletions

View File

@ -30,6 +30,16 @@ public class StringBuffer implements CharSequence {
return this; return this;
} }
public synchronized StringBuffer append(CharSequence s) {
sb.append(s);
return this;
}
public synchronized StringBuffer append(StringBuffer s) {
sb.append(s);
return this;
}
public synchronized StringBuffer append(Object o) { public synchronized StringBuffer append(Object o) {
sb.append(o); sb.append(o);
return this; return this;

View File

@ -54,6 +54,10 @@ public class StringBuilder implements CharSequence, Appendable {
} }
} }
public StringBuilder append(StringBuffer sb) {
return append(sb.toString());
}
public StringBuilder append(CharSequence sequence) { public StringBuilder append(CharSequence sequence) {
return append(sequence.toString()); return append(sequence.toString());
} }
@ -104,7 +108,6 @@ public class StringBuilder implements CharSequence, Appendable {
return append(String.valueOf(v)); return append(String.valueOf(v));
} }
public char charAt(int i) { public char charAt(int i) {
if (i < 0 || i >= length) { if (i < 0 || i >= length) {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();