Skip to content

Instantly share code, notes, and snippets.

@videlalvaro
Created August 24, 2018 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save videlalvaro/7b60e3cb68a07392e5913a42787b5f9e to your computer and use it in GitHub Desktop.
Save videlalvaro/7b60e3cb68a07392e5913a42787b5f9e to your computer and use it in GitHub Desktop.
package com.example.store.user;
/**
* Implements a user for our store.
*/
public class User {
private String name;
public User(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!(obj instanceof User))
return false;
if (obj == this)
return true;
return this.getName() == ((User) obj).getName();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment