Created
May 18, 2012 16:50
-
-
Save krisskross/2726357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Item { | |
private String id; | |
private String name; | |
public Item(String id, String name) { | |
this.id = id; | |
this.id = name; | |
} | |
public String getId() { return id;} | |
public String getName() { return name; } | |
@Override | |
public int hashCode() { | |
return Objects.hashCode(getId(), getName()); | |
} | |
@Override | |
public String toString() { | |
return Objects.toStringHelper(this).add("id", getId()).add("name", getName()).toString(); | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (!(o instanceof Item)) { | |
return false; | |
} | |
Item other = (Item) o; | |
return Objects.equal(getId(), other.getId(); | |
Objects.equal(getName(), other.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment