fork download
  1. class Ideone {
  2. public static void main(String[] args) {
  3. UserProgressModel model=new UserProgressModel("test@test.com");
  4. System.out.print(model.equals("test@test.com"));
  5. }
  6. }
  7.  
  8.  
  9. class UserProgressModel {
  10.  
  11. private String email;
  12.  
  13. public UserProgressModel(String pEmail) {
  14. super();
  15.  
  16. this.email = pEmail;
  17. }
  18.  
  19. @Override
  20. public boolean equals(Object x) {
  21.  
  22. if (x != null && x instanceof UserProgressModel
  23. && ((UserProgressModel) x).email.equals(this.email) == true) {
  24.  
  25. return true;
  26. }
  27.  
  28. if (x != null && x instanceof String
  29. && x.equals(this.email) == true) {
  30.  
  31. return true;
  32. }
  33.  
  34. return false;
  35. }
  36.  
  37. @Override
  38. public int hashCode() {
  39. int hash = 7;
  40. hash = 17 * hash + (this.email != null ? this.email.hashCode() : 0);
  41. return hash;
  42. }
  43. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
true