Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Commit 7694e8f

Browse files
committed
Remove duplicated code by calling printRecords(Iterable)
1 parent 676a580 commit 7694e8f

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/main/java/org/apache/commons/csv/CSVPrinter.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.IOException;
2727
import java.sql.ResultSet;
2828
import java.sql.SQLException;
29+
import java.util.Arrays;
2930

3031
/**
3132
* Prints values in a CSV format.
@@ -321,15 +322,7 @@ public void printRecords(final Iterable<?> values) throws IOException {
321322
* If an I/O error occurs
322323
*/
323324
public void printRecords(final Object... values) throws IOException {
324-
for (final Object value : values) {
325-
if (value instanceof Object[]) {
326-
this.printRecord((Object[]) value);
327-
} else if (value instanceof Iterable) {
328-
this.printRecord((Iterable<?>) value);
329-
} else {
330-
this.printRecord(value);
331-
}
332-
}
325+
printRecords(Arrays.asList(values));
333326
}
334327

335328
/**

0 commit comments

Comments
 (0)