This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a8c913a User ternary expression
8a8c913a is described below

commit 8a8c913a10413da256cc163c484891aa64f78555
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Apr 6 08:42:49 2024 -0400

    User ternary expression
---
 src/main/java/org/apache/commons/csv/CSVParser.java | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java 
b/src/main/java/org/apache/commons/csv/CSVParser.java
index bdc6e815..7327e114 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -524,12 +524,8 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
                 }
             }
         }
-        if (headerNames == null) {
-            headerNames = Collections.emptyList(); // immutable
-        } else {
-            headerNames = Collections.unmodifiableList(headerNames);
-        }
-        return new Headers(hdrMap, headerNames);
+        // Make header names Collection immutable
+        return new Headers(hdrMap, headerNames == null ? 
Collections.emptyList() : Collections.unmodifiableList(headerNames));
     }
 
     /**

Reply via email to