You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2016/12/21 15:58:07 UTC

[11/11] ant git commit: compareTo requires equals requires hashCode

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/1.9.x
Commit: ae7f01f64069421018c841cffce45bff0a3da339
Parents: f74ca52
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 16:57:31 2016 +0100
Committer: Stefan Bodewig <bo...@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) {