Skip to content

Commit 810e2ea

Browse files
committed
Use Objects.equals().
1 parent 9791346 commit 810e2ea

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

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

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.sql.SQLException;
4646
import java.util.Arrays;
4747
import java.util.HashSet;
48+
import java.util.Objects;
4849
import java.util.Set;
4950

5051
/**
@@ -830,32 +831,16 @@ public boolean equals(final Object obj) {
830831
if (quoteMode != other.quoteMode) {
831832
return false;
832833
}
833-
if (quoteCharacter == null) {
834-
if (other.quoteCharacter != null) {
835-
return false;
836-
}
837-
} else if (!quoteCharacter.equals(other.quoteCharacter)) {
834+
if (!Objects.equals(quoteCharacter, other.quoteCharacter)) {
838835
return false;
839836
}
840-
if (commentMarker == null) {
841-
if (other.commentMarker != null) {
842-
return false;
843-
}
844-
} else if (!commentMarker.equals(other.commentMarker)) {
837+
if (!Objects.equals(commentMarker, other.commentMarker)) {
845838
return false;
846839
}
847-
if (escapeCharacter == null) {
848-
if (other.escapeCharacter != null) {
849-
return false;
850-
}
851-
} else if (!escapeCharacter.equals(other.escapeCharacter)) {
840+
if (!Objects.equals(escapeCharacter, other.escapeCharacter)) {
852841
return false;
853842
}
854-
if (nullString == null) {
855-
if (other.nullString != null) {
856-
return false;
857-
}
858-
} else if (!nullString.equals(other.nullString)) {
843+
if (!Objects.equals(nullString, other.nullString)) {
859844
return false;
860845
}
861846
if (!Arrays.equals(header, other.header)) {
@@ -870,11 +855,7 @@ public boolean equals(final Object obj) {
870855
if (skipHeaderRecord != other.skipHeaderRecord) {
871856
return false;
872857
}
873-
if (recordSeparator == null) {
874-
if (other.recordSeparator != null) {
875-
return false;
876-
}
877-
} else if (!recordSeparator.equals(other.recordSeparator)) {
858+
if (!Objects.equals(recordSeparator, other.recordSeparator)) {
878859
return false;
879860
}
880861
if (!Arrays.equals(headerComments, other.headerComments)) {

0 commit comments

Comments
 (0)