Remove duplicated code by calling printRecords(Iterable)

This commit is contained in:
Benedikt Ritter 2018-08-21 22:05:47 +02:00
parent 676a580c35
commit 7694e8f999
No known key found for this signature in database
GPG Key ID: 9DAADC1C9FCC82D0
1 changed files with 2 additions and 9 deletions

View File

@ -26,6 +26,7 @@ import java.io.Flushable;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
/**
* Prints values in a CSV format.
@ -321,15 +322,7 @@ public final class CSVPrinter implements Flushable, Closeable {
* If an I/O error occurs
*/
public void printRecords(final Object... values) throws IOException {
for (final Object value : values) {
if (value instanceof Object[]) {
this.printRecord((Object[]) value);
} else if (value instanceof Iterable) {
this.printRecord((Iterable<?>) value);
} else {
this.printRecord(value);
}
}
printRecords(Arrays.asList(values));
}
/**