-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathUser.java
48 lines (40 loc) · 1.1 KB
/
User.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.rxjava2.android.samples.model;
/**
* Created by amitshekhar on 27/08/16.
*/
public class User {
public long id;
public String firstname;
public String lastname;
public boolean isFollowing;
public User() {
}
public User(ApiUser apiUser) {
this.id = apiUser.id;
this.firstname = apiUser.firstname;
this.lastname = apiUser.lastname;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", firstname='" + firstname + '\'' +
", lastname='" + lastname + '\'' +
", isFollowing=" + isFollowing +
'}';
}
@Override
public int hashCode() {
return (int) id + firstname.hashCode() + lastname.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof User) {
User user = (User) obj;
return this.id == user.id
&& this.firstname.equals(user.firstname)
&& this.lastname.equals(user.lastname);
}
return false;
}
}