If you see my variables for the class everything is private... Then how can I then from this object access the otherAccount followers list in the follow method?
public class TwitterAccount {
private String name;
private List<TwitterAccount> follows;
private List<TwitterAccount> followers;
private Collection<Tweet> tweetCollections;
public TwitterAccount(String name) {
this.name = name;
follows = new ArrayList<>();
followers = new ArrayList<>();
}
public String getName() {
return this.name;
}
public void follow(TwitterAccount otherAccount) {
if(this == account) {
System.err.println("Can not follow your self");
}
this.follows.add(account);
otherAccount.followers.add(this);
}