support varargs in StrBuilder.appendAll(); also convert iterable form of method to use enhanced for loop
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1407525 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
16774d1c0d
commit
fd5af17932
|
@ -992,7 +992,7 @@ public StrBuilder appendln(double value) {
|
||||||
* @return this, to enable chaining
|
* @return this, to enable chaining
|
||||||
* @since 2.3
|
* @since 2.3
|
||||||
*/
|
*/
|
||||||
public StrBuilder appendAll(Object[] array) {
|
public <T> StrBuilder appendAll(T... array) {
|
||||||
if (array != null && array.length > 0) {
|
if (array != null && array.length > 0) {
|
||||||
for (Object element : array) {
|
for (Object element : array) {
|
||||||
append(element);
|
append(element);
|
||||||
|
@ -1012,9 +1012,8 @@ public StrBuilder appendAll(Object[] array) {
|
||||||
*/
|
*/
|
||||||
public StrBuilder appendAll(Iterable<?> iterable) {
|
public StrBuilder appendAll(Iterable<?> iterable) {
|
||||||
if (iterable != null) {
|
if (iterable != null) {
|
||||||
Iterator<?> it = iterable.iterator();
|
for (Object o : iterable) {
|
||||||
while (it.hasNext()) {
|
append(o);
|
||||||
append(it.next());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue