You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/20 21:21:36 UTC

[commons-csv] branch master updated: Use Objects.equals().

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 810e2ea  Use Objects.equals().
810e2ea is described below

commit 810e2eac40ca29e1c37d345c1af01b6f44132e7e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 20 16:21:30 2020 -0500

    Use Objects.equals().
---
 .../java/org/apache/commons/csv/CSVFormat.java     | 31 +++++-----------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index c00f993..734347c 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -45,6 +45,7 @@ import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -830,32 +831,16 @@ public final class CSVFormat implements Serializable {
         if (quoteMode != other.quoteMode) {
             return false;
         }
-        if (quoteCharacter == null) {
-            if (other.quoteCharacter != null) {
-                return false;
-            }
-        } else if (!quoteCharacter.equals(other.quoteCharacter)) {
+        if (!Objects.equals(quoteCharacter, other.quoteCharacter)) {
             return false;
         }
-        if (commentMarker == null) {
-            if (other.commentMarker != null) {
-                return false;
-            }
-        } else if (!commentMarker.equals(other.commentMarker)) {
+        if (!Objects.equals(commentMarker, other.commentMarker)) {
             return false;
         }
-        if (escapeCharacter == null) {
-            if (other.escapeCharacter != null) {
-                return false;
-            }
-        } else if (!escapeCharacter.equals(other.escapeCharacter)) {
+        if (!Objects.equals(escapeCharacter, other.escapeCharacter)) {
             return false;
         }
-        if (nullString == null) {
-            if (other.nullString != null) {
-                return false;
-            }
-        } else if (!nullString.equals(other.nullString)) {
+        if (!Objects.equals(nullString, other.nullString)) {
             return false;
         }
         if (!Arrays.equals(header, other.header)) {
@@ -870,11 +855,7 @@ public final class CSVFormat implements Serializable {
         if (skipHeaderRecord != other.skipHeaderRecord) {
             return false;
         }
-        if (recordSeparator == null) {
-            if (other.recordSeparator != null) {
-                return false;
-            }
-        } else if (!recordSeparator.equals(other.recordSeparator)) {
+        if (!Objects.equals(recordSeparator, other.recordSeparator)) {
             return false;
         }
         if (!Arrays.equals(headerComments, other.headerComments)) {