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

Commit 7c770e0

Browse files
committed
Now that delimiter is a char, simplify API by removing withDelimiter(Character)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398349 13f79535-47bb-0310-9956-ffa450edef68
1 parent ae5e789 commit 7c770e0

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,19 @@ public CSVFormat(final char delimiter, final Character quoteChar, final Quote qu
171171
* @return true if <code>c</code> is a line break character
172172
*/
173173
private static boolean isLineBreak(final Character c) {
174-
return c != null && (c == LF || c == CR);
174+
return c != null && isLineBreak(c.charValue());
175+
}
176+
177+
/**
178+
* Returns true if the given character is a line break character.
179+
*
180+
* @param c
181+
* the character to check
182+
*
183+
* @return true if <code>c</code> is a line break character
184+
*/
185+
private static boolean isLineBreak(final char c) {
186+
return c == LF || c == CR;
175187
}
176188

177189
/**
@@ -226,19 +238,6 @@ public char getDelimiter() {
226238
* thrown if the specified character is a line break
227239
*/
228240
public CSVFormat withDelimiter(final char delimiter) {
229-
return withDelimiter(Character.valueOf(delimiter));
230-
}
231-
232-
/**
233-
* Returns a copy of this format using the specified delimiter character.
234-
*
235-
* @param delimiter
236-
* the delimiter character
237-
* @return A copy of this format using the specified delimiter character
238-
* @throws IllegalArgumentException
239-
* thrown if the specified character is a line break
240-
*/
241-
public CSVFormat withDelimiter(final Character delimiter) {
242241
if (isLineBreak(delimiter)) {
243242
throw new IllegalArgumentException("The delimiter cannot be a line break");
244243
}

0 commit comments

Comments
 (0)