-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTeam.java
More file actions
50 lines (40 loc) · 968 Bytes
/
Team.java
File metadata and controls
50 lines (40 loc) · 968 Bytes
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
package statCalculator;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
public class Team {
private String teamName = "";
public ArrayList<Player> playerList = new ArrayList<>();
public Team(String teamName){
this.teamName = teamName;
this.playerList = playerList;
}
public void addPlayer(Player player) {
playerList.add(player);
}
public String getName() {
return teamName;
}
public int size() {
return playerList.size();
}
public Player get(int index) {
return playerList.get(index);
}
public boolean containsPlayer(String playerName) {
for(int i=0; i<playerList.size(); i++) {
if(playerList.get(i).getName().equals(playerName)) {
return true;
}
}
return false;
}
public Player findPlayer(String player) {
for(int i=0; i<playerList.size(); i++) {
if(playerList.get(i).getName().equals(player)) {
return playerList.get(i);
}
}
return null;
}
}