Пример #1
0
 public void deleteFriend() {
   for (Friend friend : friends) {
     if (friend.getName().equals(this.deleteFriendName)) {
       friends.remove(friend);
       break;
     }
   }
 }
Пример #2
0
 public Friend getFriend(String id) {
   Friend friend = null;
   for (Friend temp : this.friends) {
     if (temp.getId().equals(id)) {
       friend = temp;
       break;
     }
   }
   return friend;
 }
Пример #3
0
 public boolean hasFriend(String name) {
   boolean has = false;
   for (Friend friend : friends) {
     if (friend.getName().equals(name)) {
       has = true;
       break;
     }
   }
   return has;
 }
Пример #4
0
 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);
       }
     }
   }
 }