import java.util.HashMap;
import java.util.Map;
public class LeagueManager implements Manager{
Map players = new HashMap();
public void addPlayer(Player player) {
players.put(player.getNick(), player);
}
public void removePlayer(Player player) {
if (!players.isEmpty()) {
players.remove(player.getNick());
}
}
public Player getPlayer(String name) {
if (!players.isEmpty() && players.containsKey(name)) {
return (Player) players.get(name);
} else {
System.out.println("Error: there is no player with nick " + name);
return null;
}
}
public Player[] getAllPlayers() {
if (!players.isEmpty()) {
return null;
} else {
return null;
}
}
public Player[] getAllPlayers() {
Player[] result = new Player[players.size()];
return players.values().toArray(result);
}
public Player[] getAllPlayers() {
return (Player[])players.values().toArray();
}