Remove duplicated code by calling printRecords(Iterable)
This commit is contained in:
parent
676a580c35
commit
7694e8f999
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue