summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-09-18 16:05:29 +0200
committerHenri Sara <henri.sara@gmail.com>2017-09-19 15:06:34 +0300
commit62d49f3c3af00e7f9a0b324e58bef560b6f9dca0 (patch)
tree2343c832c926d0c8a2b31cb81cfd44c4db7fe40c /client
parentd2a2c61b81e9441e8c3cb36336cca4bbb6c37fd4 (diff)
downloadvaadin-framework-62d49f3c3af00e7f9a0b324e58bef560b6f9dca0.tar.gz
vaadin-framework-62d49f3c3af00e7f9a0b324e58bef560b6f9dca0.zip
Implement hashCode() when implementing equals()
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/WidgetUtil.java9
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VComboBox.java12
2 files changed, 21 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java
index c9e49f13c0..3390881b72 100644
--- a/client/src/main/java/com/vaadin/client/WidgetUtil.java
+++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java
@@ -1565,6 +1565,15 @@ public class WidgetUtil {
return false;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) value;
+ result = prime * result + ((unit == null) ? 0 : unit.hashCode());
+ return result;
+ }
+
/**
* Check whether the two sizes are equals.
*
diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
index 93ac755ee1..ebb993702c 100644
--- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java
+++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
@@ -229,6 +229,18 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
}
return true;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + VComboBox.this.hashCode();
+ result = prime * result + ((key == null) ? 0 : key.hashCode());
+ result = prime * result + ((caption == null) ? 0 : caption.hashCode());
+ result = prime * result + ((untranslatedIconUri == null) ? 0 : untranslatedIconUri.hashCode());
+ result = prime * result + ((style == null) ? 0 : style.hashCode());
+ return result;
+ }
}
/** An inner class that handles all logic related to mouse wheel. */