-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFriendManager.java
More file actions
59 lines (51 loc) · 1.54 KB
/
FriendManager.java
File metadata and controls
59 lines (51 loc) · 1.54 KB
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
49
50
51
52
53
54
55
56
57
58
59
/*package network_term;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class FriendManager implements FriendManagerInterface{
private List<Friend> friendList;
public FriendManager() {
friendList = new ArrayList<Friend>();
}
public void addFriend(Friend friend) {
friendList.add(friend);
}
public List<Friend> searchFriend(String name) {
List<Friend> searchList = new ArrayList<Friend>();
for(Friend friend : friendList){
if(friend.getName().equals(name)){
searchList.add(friend);
}
}
return searchList;
}
public int deleteFriend(String phone) {
// for(Friend friend : friendList){
// if(friend.getPhone().equals(phone)){
// friendList.remove(friend);
// }
// }
/*
int size = friendLIst.size();
for(int i = 0; i < size ; i++){
if(phone.equals(friendList[i].getPhone()){
remove(friendList[i];
}
}
*/
/*
int deleteCount = 0;
Iterator<Friend> iterator = friendList.iterator();
while(iterator.hasNext()){
Friend friend = iterator.next();
if(friend.getPhone().equals(phone)){
iterator.remove();
deleteCount++;
}
}
return deleteCount;
}
public int countFriend() {
return friendList.size();
}
}*/