From 62d49f3c3af00e7f9a0b324e58bef560b6f9dca0 Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Mon, 18 Sep 2017 16:05:29 +0200 Subject: Implement hashCode() when implementing equals() --- client/src/main/java/com/vaadin/client/WidgetUtil.java | 9 +++++++++ client/src/main/java/com/vaadin/client/ui/VComboBox.java | 12 ++++++++++++ 2 files changed, 21 insertions(+) (limited to 'client') 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. */ -- cgit v1.2.3