-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFollower.java
42 lines (32 loc) · 954 Bytes
/
Follower.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
import java.util.*;
/**
*
* @author jmcgr
*/
public class Follower implements Observer {
private List<String> followingPosts = new ArrayList<>();
private String name;
public Follower(User thisUser){
this.name = thisUser.getID();
getOwnPosts(thisUser);
}
public String getFollowerName(){
return this.name;
}
public String toString(){
String newString = this.getFollowerName();
return newString;
}
public List getFollowingPosts(){
return this.followingPosts;
}
public void getOwnPosts(User user){
for(int i = 0; i < user.getPosts().size(); i++){
this.getFollowingPosts().add(user.getPosts().get(i));
}
}
@Override
public void update(User user) {
System.out.println(this.name + " received a new post: " + user.getPost());
}
}