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
|
||||
* @since 2.3
|
||||
*/
|
||||
public StrBuilder appendAll(Object[] array) {
|
||||
public <T> StrBuilder appendAll(T... array) {
|
||||
if (array != null && array.length > 0) {
|
||||
for (Object element : array) {
|
||||
append(element);
|
||||
|
@ -1012,9 +1012,8 @@ public StrBuilder appendAll(Object[] array) {
|
|||
*/
|
||||
public StrBuilder appendAll(Iterable<?> iterable) {
|
||||
if (iterable != null) {
|
||||
Iterator<?> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
append(it.next());
|
||||
for (Object o : iterable) {
|
||||
append(o);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue