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:40:17 UTC

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

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 724c43f  Use Objects.hash().
724c43f is described below

commit 724c43fe4e0ce559ae7effc3be82d01d5f1f3a00
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 20 16:40:12 2020 -0500

    Use Objects.hash().
---
 .../java/org/apache/commons/csv/CSVFormat.java     | 26 ++++------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 734347c..cd19936 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -1061,28 +1061,10 @@ public final class CSVFormat implements Serializable {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-
-        result = prime * result + delimiter;
-        result = prime * result + ((quoteMode == null) ? 0 : quoteMode.hashCode());
-        result = prime * result + ((quoteCharacter == null) ? 0 : quoteCharacter.hashCode());
-        result = prime * result + ((commentMarker == null) ? 0 : commentMarker.hashCode());
-        result = prime * result + ((escapeCharacter == null) ? 0 : escapeCharacter.hashCode());
-        result = prime * result + ((nullString == null) ? 0 : nullString.hashCode());
-        result = prime * result + (ignoreSurroundingSpaces ? 1231 : 1237);
-        result = prime * result + (ignoreHeaderCase ? 1231 : 1237);
-        result = prime * result + (ignoreEmptyLines ? 1231 : 1237);
-        result = prime * result + (skipHeaderRecord ? 1231 : 1237);
-        result = prime * result + (allowDuplicateHeaderNames ? 1231 : 1237);
-        result = prime * result + (trim ? 1231 : 1237);
-        result = prime * result + (autoFlush ? 1231 : 1237);
-        result = prime * result + (trailingDelimiter ? 1231 : 1237);
-        result = prime * result + (allowMissingColumnNames ? 1231 : 1237);
-        result = prime * result + ((recordSeparator == null) ? 0 : recordSeparator.hashCode());
-        result = prime * result + Arrays.hashCode(header);
-        result = prime * result + Arrays.hashCode(headerComments);
-        return result;
+        return Objects.hash(delimiter, quoteMode, quoteCharacter, commentMarker, escapeCharacter, nullString,
+            ignoreSurroundingSpaces, ignoreHeaderCase, ignoreEmptyLines, skipHeaderRecord, allowDuplicateHeaderNames,
+            trim, autoFlush, trailingDelimiter, allowMissingColumnNames, recordSeparator, Arrays.hashCode(header),
+            Arrays.hashCode(headerComments));
     }
 
     /**