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 da55604  [CSV-239] Cannot get headers in column order from CSVRecord.
da55604 is described below

commit da55604794b31f84eaa1a04205fe4d9a6573749c
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Mon May 20 19:53:15 2019 -0400

    [CSV-239] Cannot get headers in column order from CSVRecord.
    
    CSVParser.createHeaderNames(Map<String, Integer>) -> private and
    instance side.
---
 .../java/org/apache/commons/csv/CSVParser.java     | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java 
b/src/main/java/org/apache/commons/csv/CSVParser.java
index 95dbfc6..7b42206 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -183,16 +183,6 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
         }
     }
 
-    static List<String> createHeaderNames(final Map<String, Integer> 
headerMap) {
-        // @formatter:off
-        return headerMap == null ? null
-            : headerMap.entrySet().stream()
-                .sorted(Map.Entry.comparingByValue())
-                .map(Map.Entry::getKey)
-                .collect(Collectors.collectingAndThen(Collectors.toList(), 
Collections::unmodifiableList));
-        // @formatter:on
-    }
-
     /**
      * Creates a parser for the given {@link File}.
      *
@@ -289,8 +279,6 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
         return new CSVParser(reader, format);
     }
 
-    // the following objects are shared to reduce garbage
-
     /**
      * Creates a parser for the given {@link String}.
      *
@@ -311,6 +299,8 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
         return new CSVParser(new StringReader(string), format);
     }
 
+    // the following objects are shared to reduce garbage
+
     /**
      * Creates a parser for the given URL.
      *
@@ -498,6 +488,16 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
         return hdrMap;
     }
 
+    private List<String> createHeaderNames(final Map<String, Integer> 
headerMap) {
+        // @formatter:off
+        return headerMap == null ? null
+            : headerMap.entrySet().stream()
+                .sorted(Map.Entry.comparingByValue())
+                .map(Map.Entry::getKey)
+                .collect(Collectors.collectingAndThen(Collectors.toList(), 
Collections::unmodifiableList));
+        // @formatter:on
+    }
+
     /**
      * Returns the current line number in the input stream.
      *

Reply via email to