Java Reference
In-Depth Information
* the team.
*/
public class TeamImpl implements Team {
private String name;
private ArrayList players = new ArrayList();
/**
* Create a TeamImpl object, with the name
* supplied.
*/
public TeamImpl(String teamName){
name = teamName;
}
/**
* Return a <code>String</code> that is the name of
* this team.
*/
public String getName(){
return name;
}
/**
* Return a list of the players that are on this
* team.
*/
public List getPlayerList(){
return players;
}
/**
* Add a player to the team.
*/
public void addPlayer(Player toAdd){
if (players.contains(toAdd)){
return;
}
players.add(toAdd);
}
/**
* Remove a player from the team.
*/
public void removePlayer(Player toRemove){
while (players.contains(toRemove)){
players.remove(toRemove);
}
}
}
Search WWH ::




Custom Search