Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Team implements Comparable <Team> {
- private String name;
- public Team() {
- this.name = "";
- }
- public Team(String userName) {
- this.name = userName;
- }
- public String getName() {
- return name;
- }
- public void setName(String userName) {
- this.name = userName;
- }
- public String toString() {
- return "The name is: " + name;
- }
- @Override
- public boolean equals(Object other) {
- if (other instanceof Team) {
- Team that = (Team) other;
- return this.name.equalsIgnoreCase(that.name);
- } else {
- return false;
- }
- }
- @Override
- public int compareTo(Team other) {
- return this.getName().compareToIgnoreCase(other.getName());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment