Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
osiegmar committed Jan 1, 2024
1 parent 79582a8 commit d8836c7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/src/main/java/de/siegmar/fastcsv/writer/CsvWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public CsvWriter writeRecord(final Iterable<String> values) {
try {
int fieldIdx = 0;
for (final String value : values) {
if (fieldIdx > 0) {
writer.write(fieldSeparator);
}
writeInternal(value, fieldIdx++);
}
endRecord();
Expand All @@ -114,9 +111,6 @@ public CsvWriter writeRecord(final Iterable<String> values) {
public CsvWriter writeRecord(final String... values) {
try {
for (int i = 0; i < values.length; i++) {
if (i > 0) {
writer.write(fieldSeparator);
}
writeInternal(values[i], i);
}
endRecord();
Expand All @@ -129,6 +123,10 @@ public CsvWriter writeRecord(final String... values) {

@SuppressWarnings("checkstyle:BooleanExpressionComplexity")
private void writeInternal(final String value, final int fieldIdx) throws IOException {
if (fieldIdx > 0) {
writer.write(fieldSeparator);
}

if (value == null) {
if (quoteStrategy != null && quoteStrategy.quoteNull(currentLineNo, fieldIdx)) {
writer.write(emptyFieldValue);
Expand Down

0 comments on commit d8836c7

Please sign in to comment.