ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [11/12] ant git commit: compareTo requires equals requires hashCode
Date Wed, 21 Dec 2016 16:00:00 GMT
compareTo requires equals requires hashCode


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ae7f01f6
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ae7f01f6
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ae7f01f6

Branch: refs/heads/master
Commit: ae7f01f64069421018c841cffce45bff0a3da339
Parents: f74ca52
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Wed Dec 21 16:57:31 2016 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Wed Dec 21 16:57:31 2016 +0100

----------------------------------------------------------------------
 .../ant/taskdefs/optional/EchoProperties.java     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/ae7f01f6/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
index d8ef51a..30bcc75 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
@@ -440,6 +440,24 @@ public class EchoProperties extends Task {
             Tuple that = (Tuple) o;
             return key.compareTo(that.key);
         }
+
+        @Override
+        public boolean equals(Object o) {
+            if (o == this) {
+                return true;
+            }
+            if (o == null || o.getClass() != getClass()) {
+                return false;
+            }
+            Tuple that = (Tuple) o;
+            return (key == null ? that.key == null : key.equals(that.key))
+                && (value == null ? that.value == null : value.equals(that.value));
+        }
+
+        @Override
+        public int hashCode() {
+            return key != null ? key.hashCode() : 0;
+        }
     }
 
     private List sortProperties(Properties props) {


Mime
View raw message