Synced with master
This commit is contained in:
parent
ac794a722f
commit
491e2d8493
|
@ -12,7 +12,6 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m
|
||||||
- [Guide to the Cactoos Library](https://www.baeldung.com/java-cactoos)
|
- [Guide to the Cactoos Library](https://www.baeldung.com/java-cactoos)
|
||||||
- [Parsing Command-Line Parameters with Airline](https://www.baeldung.com/java-airline)
|
- [Parsing Command-Line Parameters with Airline](https://www.baeldung.com/java-airline)
|
||||||
- [Introduction to cache2k](https://www.baeldung.com/java-cache2k)
|
- [Introduction to cache2k](https://www.baeldung.com/java-cache2k)
|
||||||
- [Using NullAway to Avoid NullPointerExceptions](https://www.baeldung.com/java-nullaway)
|
|
||||||
- [Introduction to the jcabi-aspects AOP Annotations Library](https://www.baeldung.com/java-jcabi-aspects)
|
- [Introduction to the jcabi-aspects AOP Annotations Library](https://www.baeldung.com/java-jcabi-aspects)
|
||||||
- [Introduction to Takes](https://www.baeldung.com/java-takes)
|
- [Introduction to Takes](https://www.baeldung.com/java-takes)
|
||||||
- [Using NullAway to Avoid NullPointerExceptions](https://www.baeldung.com/java-nullaway)
|
- [Using NullAway to Avoid NullPointerExceptions](https://www.baeldung.com/java-nullaway)
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
package com.baeldung.distinct;
|
|
||||||
|
|
||||||
public class Person {
|
|
||||||
int age;
|
|
||||||
String name;
|
|
||||||
String email;
|
|
||||||
|
|
||||||
public Person(int age, String name, String email) {
|
|
||||||
super();
|
|
||||||
this.age = age;
|
|
||||||
this.name = name;
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAge() {
|
|
||||||
return age;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("Person [age=");
|
|
||||||
builder.append(age);
|
|
||||||
builder.append(", name=");
|
|
||||||
builder.append(name);
|
|
||||||
builder.append(", email=");
|
|
||||||
builder.append(email);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((email == null) ? 0 : email.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Person other = (Person) obj;
|
|
||||||
if (email == null) {
|
|
||||||
if (other.email != null)
|
|
||||||
return false;
|
|
||||||
} else if (!email.equals(other.email))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue