From 7c770e0b53235e90a216ae3b214048b765cda0c0 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Mon, 15 Oct 2012 15:53:09 +0000 Subject: [PATCH] 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 --- .../org/apache/commons/csv/CSVFormat.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index 8b28d3c4..ec637003 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -171,7 +171,19 @@ public class CSVFormat implements Serializable { * @return true if c is a line break character */ private static boolean isLineBreak(final Character c) { - return c != null && (c == LF || c == CR); + return c != null && isLineBreak(c.charValue()); + } + + /** + * Returns true if the given character is a line break character. + * + * @param c + * the character to check + * + * @return true if c is a line break character + */ + private static boolean isLineBreak(final char c) { + return c == LF || c == CR; } /** @@ -226,19 +238,6 @@ public class CSVFormat implements Serializable { * thrown if the specified character is a line break */ public CSVFormat withDelimiter(final char delimiter) { - return withDelimiter(Character.valueOf(delimiter)); - } - - /** - * Returns a copy of this format using the specified delimiter character. - * - * @param delimiter - * the delimiter character - * @return A copy of this format using the specified delimiter character - * @throws IllegalArgumentException - * thrown if the specified character is a line break - */ - public CSVFormat withDelimiter(final Character delimiter) { if (isLineBreak(delimiter)) { throw new IllegalArgumentException("The delimiter cannot be a line break"); }