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

Commit 31e00ad

Browse files
committed
Use forEachOrdered()
1 parent 1e05168 commit 31e00ad

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,9 @@ public synchronized void println() throws IOException {
259259
* @throws IOException
260260
* If an I/O error occurs
261261
*/
262+
@SuppressWarnings("resource")
262263
public synchronized void printRecord(final Iterable<?> values) throws IOException {
263-
for (final Object value : values) {
264-
print(value);
265-
}
264+
IOStream.of(values).forEachOrdered(this::print);
266265
println();
267266
}
268267

@@ -352,10 +351,9 @@ private void printRecordObject(final Object value) throws IOException {
352351
* @throws IOException
353352
* If an I/O error occurs
354353
*/
354+
@SuppressWarnings("resource")
355355
public void printRecords(final Iterable<?> values) throws IOException {
356-
for (final Object value : values) {
357-
printRecordObject(value);
358-
}
356+
IOStream.of(values).forEachOrdered(this::printRecordObject);
359357
}
360358

361359
/**

0 commit comments

Comments
 (0)