@@ -688,8 +688,12 @@ public static CSVFormat valueOf(final String format) {
688688 return CSVFormat .Predefined .valueOf (format ).getFormat ();
689689 }
690690
691+ private final boolean allowDuplicateHeaderNames ;
692+
691693 private final boolean allowMissingColumnNames ;
692694
695+ private final boolean autoFlush ;
696+
693697 private final Character commentMarker ; // null if commenting is disabled
694698
695699 private final char delimiter ;
@@ -722,10 +726,6 @@ public static CSVFormat valueOf(final String format) {
722726
723727 private final boolean trim ;
724728
725- private final boolean autoFlush ;
726-
727- private final boolean allowDuplicateHeaderNames ;
728-
729729 /**
730730 * Creates a customized CSV format.
731731 *
@@ -880,6 +880,10 @@ public String format(final Object... values) {
880880 }
881881 }
882882
883+ public boolean getAllowDuplicateHeaderNames () {
884+ return allowDuplicateHeaderNames ;
885+ }
886+
883887 /**
884888 * Specifies whether missing column names are allowed when parsing the header line.
885889 *
@@ -1669,6 +1673,17 @@ private void validate() throws IllegalArgumentException {
16691673 }
16701674 }
16711675
1676+ public CSVFormat withAllowDuplicateHeaderNames () {
1677+ return withAllowDuplicateHeaderNames (true );
1678+ }
1679+
1680+ public CSVFormat withAllowDuplicateHeaderNames (final boolean allowDuplicateHeaderNames ) {
1681+ return new CSVFormat (delimiter , quoteCharacter , quoteMode , commentMarker , escapeCharacter ,
1682+ ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , headerComments , header ,
1683+ skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush ,
1684+ allowDuplicateHeaderNames );
1685+ }
1686+
16721687 /**
16731688 * Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
16741689 *
@@ -2257,19 +2272,4 @@ public CSVFormat withTrim(final boolean trim) {
22572272 skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush ,
22582273 allowDuplicateHeaderNames );
22592274 }
2260-
2261- public CSVFormat withAllowDuplicateHeaderNames (final boolean allowDuplicateHeaderNames ) {
2262- return new CSVFormat (delimiter , quoteCharacter , quoteMode , commentMarker , escapeCharacter ,
2263- ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , headerComments , header ,
2264- skipHeaderRecord , allowMissingColumnNames , ignoreHeaderCase , trim , trailingDelimiter , autoFlush ,
2265- allowDuplicateHeaderNames );
2266- }
2267-
2268- public CSVFormat withAllowDuplicateHeaderNames () {
2269- return withAllowDuplicateHeaderNames (true );
2270- }
2271-
2272- public boolean getAllowDuplicateHeaderNames () {
2273- return allowDuplicateHeaderNames ;
2274- }
22752275}
0 commit comments