changeset 68:d0a41174ca5f

Add equals and hashCode to BundleInformation
author Omair Majid <omajid@redhat.com>
date Fri, 03 Jan 2014 12:13:34 -0500
parents f6c371a0cb17
children 69f2305c7471
files src/com/redhat/thermostat/plugin/eclipse/model/BundleInformation.java
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/redhat/thermostat/plugin/eclipse/model/BundleInformation.java	Thu Jan 02 17:05:44 2014 -0500
+++ b/src/com/redhat/thermostat/plugin/eclipse/model/BundleInformation.java	Fri Jan 03 12:13:34 2014 -0500
@@ -1,5 +1,7 @@
 package com.redhat.thermostat.plugin.eclipse.model;
 
+import java.util.Objects;
+
 public class BundleInformation {
 
     private final String name;
@@ -21,4 +23,18 @@
     public String toString() {
         return this.name + " (" + this.version + ")";
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof BundleInformation)) {
+            return false;
+        }
+        BundleInformation other = (BundleInformation) obj;
+        return Objects.equals(this.name, other.name) && Objects.equals(this.version, other.version);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(this.name, this.version);
+    }
 }