public void deleteFriend() { for (Friend friend : friends) { if (friend.getName().equals(this.deleteFriendName)) { friends.remove(friend); break; } } }
public Friend getFriend(String id) { Friend friend = null; for (Friend temp : this.friends) { if (temp.getId().equals(id)) { friend = temp; break; } } return friend; }
public boolean hasFriend(String name) { boolean has = false; for (Friend friend : friends) { if (friend.getName().equals(name)) { has = true; break; } } return has; }
public void updateOnlineInfo(String id) { for (Friend friend : this.friends) { if (friend.getId().equals(id)) { if (friend.isInline()) { friend.setInline(false); } else { friend.setInline(true); } } } }